diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 12:08:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-27 12:08:32 +0300 |
commit | c8e28a0bb8dd45d91cb72ff2c930bc4a562f1fc7 (patch) | |
tree | a6b5d07b456c9494eb68ed210af74b58dc699a26 /spec/requests/api/project_import_spec.rb | |
parent | eace733dca6e5c87315b42f42eb4d8f05934d6de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/project_import_spec.rb')
-rw-r--r-- | spec/requests/api/project_import_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb index 186f0f52a46..71dd8fee0ae 100644 --- a/spec/requests/api/project_import_spec.rb +++ b/spec/requests/api/project_import_spec.rb @@ -196,6 +196,19 @@ describe API::ProjectImport do end end + context 'when request exceeds the rate limit' do + before do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true) + end + + it 'prevents users from importing projects' do + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.id } + + expect(response).to have_gitlab_http_status(429) + expect(json_response['message']['error']).to eq('This endpoint has been requested too many times. Try again later.') + end + end + def stub_import(namespace) expect_any_instance_of(ProjectImportState).to receive(:schedule) expect(::Projects::CreateService).to receive(:new).with(user, hash_including(namespace_id: namespace.id)).and_call_original |