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-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/requests/api/group_export_spec.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/requests/api/group_export_spec.rb')
-rw-r--r--spec/requests/api/group_export_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/requests/api/group_export_spec.rb b/spec/requests/api/group_export_spec.rb
index 02ae9d71702..9dd7797c768 100644
--- a/spec/requests/api/group_export_spec.rb
+++ b/spec/requests/api/group_export_spec.rb
@@ -82,6 +82,22 @@ describe API::GroupExport do
expect(response).to have_gitlab_http_status(:not_found)
end
end
+
+ context 'when the requests have exceeded the rate limit' do
+ before do
+ allow(Gitlab::ApplicationRateLimiter)
+ .to receive(:increment)
+ .and_return(Gitlab::ApplicationRateLimiter.rate_limits[:group_download_export][:threshold] + 1)
+ end
+
+ it 'throttles the endpoint' do
+ get api(download_path, user)
+
+ expect(json_response["message"])
+ .to include('error' => 'This endpoint has been requested too many times. Try again later.')
+ expect(response).to have_gitlab_http_status :too_many_requests
+ end
+ end
end
describe 'POST /groups/:group_id/export' do
@@ -139,5 +155,23 @@ describe API::GroupExport do
expect(response).to have_gitlab_http_status(:not_found)
end
end
+
+ context 'when the requests have exceeded the rate limit' do
+ before do
+ group.add_owner(user)
+
+ allow(Gitlab::ApplicationRateLimiter)
+ .to receive(:increment)
+ .and_return(Gitlab::ApplicationRateLimiter.rate_limits[:group_export][:threshold] + 1)
+ end
+
+ it 'throttles the endpoint' do
+ post api(path, user)
+
+ expect(json_response["message"])
+ .to include('error' => 'This endpoint has been requested too many times. Try again later.')
+ expect(response).to have_gitlab_http_status :too_many_requests
+ end
+ end
end
end