Commit 8d4649d1 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'georgekoltsov/group-import-feature-flag' into 'master'

Add feature flag for Group Export API endpoint

Closes #36395

See merge request gitlab-org/gitlab!22423
parents e2a33054 371e1ec2
......@@ -3,6 +3,8 @@
module API
class GroupExport < Grape::API
before do
not_found! unless Feature.enabled?(:group_import_export, user_group, default_enabled: true)
authorize! :admin_group, user_group
end
......
......@@ -30,6 +30,11 @@ describe API::GroupExport do
group.add_owner(user)
end
context 'group_import_export feature flag enabled' do
before do
stub_feature_flags(group_import_export: true)
end
context 'when export file exists' do
before do
upload.export_file = fixture_file_upload('spec/fixtures/group_export.tar.gz', "`/tar.gz")
......@@ -66,7 +71,25 @@ describe API::GroupExport do
end
end
context 'group_import_export feature flag disabled' do
before do
stub_feature_flags(group_import_export: false)
end
it 'responds with 404 Not Found' do
get api(download_path, user)
expect(response).to have_gitlab_http_status(404)
end
end
end
describe 'POST /groups/:group_id/export' do
context 'group_import_export feature flag enabled' do
before do
stub_feature_flags(group_import_export: true)
end
context 'when user is a group owner' do
before do
group.add_owner(user)
......@@ -91,4 +114,17 @@ describe API::GroupExport do
end
end
end
context 'group_import_export feature flag disabled' do
before do
stub_feature_flags(group_import_export: false)
end
it 'responds with 404 Not Found' do
post api(path, user)
expect(response).to have_gitlab_http_status(404)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment