summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-01 12:17:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-01 12:17:40 +0000
commit5e98d2784081393aea84b6591116d905da6eb567 (patch)
treef18117de3f067c2511861c3d2343b7c951032dae /spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb
parent2655540094e856f3048fb737a19e4316d8264623 (diff)
downloadgitlab-ce-5e98d2784081393aea84b6591116d905da6eb567.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-10-stable-ee
Diffstat (limited to 'spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb b/spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb
index 44baadaaade..e94f063399d 100644
--- a/spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb
+++ b/spec/support/shared_examples/controllers/import_controller_status_shared_examples.rb
@@ -19,4 +19,26 @@ RSpec.shared_examples 'import controller status' do
expect(json_response.dig("imported_projects", 0, "id")).to eq(project.id)
expect(json_response.dig("provider_repos", 0, "id")).to eq(repo_id)
end
+
+ context 'when format is html' do
+ context 'when namespace_id is present' do
+ let!(:developer_group) { create(:group).tap { |g| g.add_developer(user) } }
+
+ context 'when user cannot import projects' do
+ it 'returns 404' do
+ get :status, params: { namespace_id: developer_group.id }, format: :html
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
+ end
+
+ context 'when user can import projects' do
+ it 'returns 200' do
+ get :status, params: { namespace_id: group.id }, format: :html
+
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end
+ end
+ end
end