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:
Diffstat (limited to 'spec/requests/api/project_export_spec.rb')
-rw-r--r--spec/requests/api/project_export_spec.rb44
1 files changed, 35 insertions, 9 deletions
diff --git a/spec/requests/api/project_export_spec.rb b/spec/requests/api/project_export_spec.rb
index 3603a71151e..22729e068da 100644
--- a/spec/requests/api/project_export_spec.rb
+++ b/spec/requests/api/project_export_spec.rb
@@ -704,31 +704,63 @@ RSpec.describe API::ProjectExport, :aggregate_failures, :clean_gitlab_redis_cach
context 'with bulk_import is disabled' do
before do
stub_application_setting(bulk_import_enabled: false)
+ stub_feature_flags(override_bulk_import_disabled: false)
+ end
+
+ shared_examples 'flag override' do |expected_http_status:|
+ it 'enables the feature when override flag is enabled for the user' do
+ stub_feature_flags(override_bulk_import_disabled: user)
+
+ request
+
+ expect(response).to have_gitlab_http_status(expected_http_status)
+ end
+
+ it 'does not enable the feature when override flag is enabled for another user' do
+ other_user = create(:user)
+ stub_feature_flags(override_bulk_import_disabled: other_user)
+
+ request
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
end
describe 'POST /projects/:id/export_relations' do
+ subject(:request) { post api(path, user) }
+
it_behaves_like '404 response' do
- subject(:request) { post api(path, user) }
+ let(:message) { '404 Not Found' }
end
+
+ it_behaves_like 'flag override', expected_http_status: :accepted
end
describe 'GET /projects/:id/export_relations/download' do
let_it_be(:export) { create(:bulk_import_export, project: project, relation: 'labels') }
let_it_be(:upload) { create(:bulk_import_export_upload, export: export) }
+ subject(:request) { get api(download_path, user) }
+
before do
upload.update!(export_file: fixture_file_upload('spec/fixtures/bulk_imports/gz/labels.ndjson.gz'))
end
it_behaves_like '404 response' do
- subject(:request) { post api(path, user) }
+ let(:message) { '404 Not Found' }
end
+
+ it_behaves_like 'flag override', expected_http_status: :ok
end
describe 'GET /projects/:id/export_relations/status' do
+ subject(:request) { get api(status_path, user) }
+
it_behaves_like '404 response' do
- subject(:request) { get api(status_path, user) }
+ let(:message) { '404 Not Found' }
end
+
+ it_behaves_like 'flag override', expected_http_status: :ok
end
end
end
@@ -758,11 +790,5 @@ RSpec.describe API::ProjectExport, :aggregate_failures, :clean_gitlab_redis_cach
end
end
end
-
- context 'when bulk import is disabled' do
- it_behaves_like '404 response' do
- subject(:request) { get api(path, user) }
- end
- end
end
end