diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
commit | ed45528885b7b44c61f18175fe7cdbda12360669 (patch) | |
tree | 3d27c00a8a83d569cf238eaa05b7eb24b7a28a8d /spec/requests/api | |
parent | ab85af0f318ccbcfdd508e7a2f85788f26831785 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/repositories_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 8bca458bece..b1a65ded9ef 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -223,6 +223,10 @@ describe API::Repositories do describe "GET /projects/:id/repository/archive(.:format)?:sha" do let(:route) { "/projects/#{project.id}/repository/archive" } + before do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(false) + end + shared_examples_for 'repository archive' do it 'returns the repository archive' do get api(route, current_user) @@ -263,6 +267,14 @@ describe API::Repositories do let(:message) { '404 File Not Found' } end end + + it 'rate limits user when thresholds hit' do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true) + + get api("/projects/#{project.id}/repository/archive.tar.bz2", user) + + expect(response).to have_gitlab_http_status(:too_many_requests) + end end context 'when unauthenticated', 'and project is public' do |