Commit 8344d215 authored by wortschi's avatar wortschi

Remove import_project_from_remote_file ff

Changelog: other
parent bc8a1f1f
---
name: import_project_from_remote_file
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59033
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330039
milestone: '13.12'
type: development
group: group::import
default_enabled: true
...@@ -135,8 +135,6 @@ module API ...@@ -135,8 +135,6 @@ module API
success Entities::ProjectImportStatus success Entities::ProjectImportStatus
end end
post 'remote-import' do post 'remote-import' do
not_found! unless ::Feature.enabled?(:import_project_from_remote_file, default_enabled: :yaml)
check_rate_limit! :project_import, scope: [current_user, :project_import] check_rate_limit! :project_import, scope: [current_user, :project_import]
response = ::Import::GitlabProjects::CreateProjectService.new( response = ::Import::GitlabProjects::CreateProjectService.new(
......
...@@ -306,63 +306,49 @@ RSpec.describe API::ProjectImport, :aggregate_failures do ...@@ -306,63 +306,49 @@ RSpec.describe API::ProjectImport, :aggregate_failures do
it_behaves_like 'requires authentication' it_behaves_like 'requires authentication'
it 'returns NOT FOUND when the feature is disabled' do context 'when the response is successful' do
stub_feature_flags(import_project_from_remote_file: false) it 'schedules the import successfully' do
project = create(
subject :project,
namespace: user.namespace,
expect(response).to have_gitlab_http_status(:not_found) name: 'test-import',
end path: 'test-import'
)
context 'when the feature flag is enabled' do
before do
stub_feature_flags(import_project_from_remote_file: true)
end
context 'when the response is successful' do
it 'schedules the import successfully' do
project = create(
:project,
namespace: user.namespace,
name: 'test-import',
path: 'test-import'
)
service_response = ServiceResponse.success(payload: project) service_response = ServiceResponse.success(payload: project)
expect_next(::Import::GitlabProjects::CreateProjectService) expect_next(::Import::GitlabProjects::CreateProjectService)
.to receive(:execute) .to receive(:execute)
.and_return(service_response) .and_return(service_response)
subject subject
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(json_response).to include({ expect(json_response).to include({
'id' => project.id, 'id' => project.id,
'name' => 'test-import', 'name' => 'test-import',
'name_with_namespace' => "#{user.namespace.name} / test-import", 'name_with_namespace' => "#{user.namespace.name} / test-import",
'path' => 'test-import', 'path' => 'test-import',
'path_with_namespace' => "#{user.namespace.path}/test-import" 'path_with_namespace' => "#{user.namespace.path}/test-import"
}) })
end
end end
end
context 'when the service returns an error' do context 'when the service returns an error' do
it 'fails to schedule the import' do it 'fails to schedule the import' do
service_response = ServiceResponse.error( service_response = ServiceResponse.error(
message: 'Failed to import', message: 'Failed to import',
http_status: :bad_request http_status: :bad_request
) )
expect_next(::Import::GitlabProjects::CreateProjectService) expect_next(::Import::GitlabProjects::CreateProjectService)
.to receive(:execute) .to receive(:execute)
.and_return(service_response) .and_return(service_response)
subject subject
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response).to eq({ expect(json_response).to eq({
'message' => 'Failed to import' 'message' => 'Failed to import'
}) })
end
end end
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