summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-01-14 21:10:48 -0800
committerStan Hu <stanhu@gmail.com>2018-01-14 22:22:06 -0800
commit0d187a9a65c5a8eae4bcb09228270cb974abd466 (patch)
tree7a958c51641edb5c8606380d673587f35deeeb8f /spec/services
parent74f2f9b30fb1972a26481072486b358eb943309f (diff)
downloadgitlab-ce-0d187a9a65c5a8eae4bcb09228270cb974abd466.tar.gz
Log and send a system hook if a blocked user fails to loginsh-log-when-user-blocked
Closes #41633
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/system_hooks_service_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 46cd10cdc12..c40cd5b7548 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -105,12 +105,25 @@ describe SystemHooksService do
expect(data[:old_username]).to eq(user.username_was)
end
end
+
+ context 'user_failed_login' do
+ it 'contains state of user' do
+ user.ldap_block!
+
+ data = event_data(user, :failed_login)
+
+ expect(data).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id, :username, :state)
+ expect(data[:username]).to eq(user.username)
+ expect(data[:state]).to eq('ldap_blocked')
+ end
+ end
end
context 'event names' do
it { expect(event_name(user, :create)).to eq "user_create" }
it { expect(event_name(user, :destroy)).to eq "user_destroy" }
it { expect(event_name(user, :rename)).to eq 'user_rename' }
+ it { expect(event_name(user, :failed_login)).to eq 'user_failed_login' }
it { expect(event_name(project, :create)).to eq "project_create" }
it { expect(event_name(project, :destroy)).to eq "project_destroy" }
it { expect(event_name(project, :rename)).to eq "project_rename" }