Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-22 15:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-22 15:08:58 +0300
commited45528885b7b44c61f18175fe7cdbda12360669 (patch)
tree3d27c00a8a83d569cf238eaa05b7eb24b7a28a8d /spec/requests/api
parentab85af0f318ccbcfdd508e7a2f85788f26831785 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/repositories_spec.rb12
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