diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 00:06:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 00:06:29 +0300 |
commit | 430999251558db3c64b4adfc6e2b4fb771f6cd48 (patch) | |
tree | dd8bb7eab17ab8072179b9636bde34ec67ea17f5 /spec/support/shared_examples/requests | |
parent | e66d6781ef36e39d15b1b9bc84cc30e87969edad (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/requests')
-rw-r--r-- | spec/support/shared_examples/requests/rack_attack_shared_examples.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/support/shared_examples/requests/rack_attack_shared_examples.rb b/spec/support/shared_examples/requests/rack_attack_shared_examples.rb index afc6f59b773..a2e38cfc60b 100644 --- a/spec/support/shared_examples/requests/rack_attack_shared_examples.rb +++ b/spec/support/shared_examples/requests/rack_attack_shared_examples.rb @@ -8,6 +8,14 @@ # * period_in_seconds # * period shared_examples_for 'rate-limited token-authenticated requests' do + let(:throttle_types) do + { + "throttle_protected_paths" => "throttle_authenticated_protected_paths_api", + "throttle_authenticated_api" => "throttle_authenticated_api", + "throttle_authenticated_web" => "throttle_authenticated_web" + } + end + before do # Set low limits settings_to_set[:"#{throttle_setting_prefix}_requests_per_period"] = requests_per_period @@ -84,7 +92,8 @@ shared_examples_for 'rate-limited token-authenticated requests' do request_method: 'GET', path: get_args.first, user_id: user.id, - username: user.username + username: user.username, + throttle_type: throttle_types[throttle_setting_prefix] } expect(Gitlab::AuthLogger).to receive(:error).with(arguments).once @@ -116,6 +125,13 @@ end # * period_in_seconds # * period shared_examples_for 'rate-limited web authenticated requests' do + let(:throttle_types) do + { + "throttle_protected_paths" => "throttle_authenticated_protected_paths_web", + "throttle_authenticated_web" => "throttle_authenticated_web" + } + end + before do login_as(user) @@ -196,7 +212,8 @@ shared_examples_for 'rate-limited web authenticated requests' do request_method: 'GET', path: '/dashboard/snippets', user_id: user.id, - username: user.username + username: user.username, + throttle_type: throttle_types[throttle_setting_prefix] } expect(Gitlab::AuthLogger).to receive(:error).with(arguments).once |