diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/requests/api/projects_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/requests/api/projects_spec.rb')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 7ad1ce0ede9..38f7d6e3eba 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -221,6 +221,16 @@ RSpec.describe API::Projects do expect(project_response['container_registry_enabled']).to eq(false) end + it 'includes releases_access_level', :aggregate_failures do + project.project_feature.update!(releases_access_level: ProjectFeature::DISABLED) + + get api('/projects', user) + project_response = json_response.find { |p| p['id'] == project.id } + + expect(response).to have_gitlab_http_status(:ok) + expect(project_response['releases_access_level']).to eq('disabled') + end + context 'when some projects are in a group' do before do create(:project, :public, group: create(:group)) @@ -1171,6 +1181,7 @@ RSpec.describe API::Projects do attrs[:analytics_access_level] = 'disabled' attrs[:container_registry_access_level] = 'private' attrs[:security_and_compliance_access_level] = 'private' + attrs[:releases_access_level] = 'disabled' end post api('/projects', user), params: project @@ -1180,7 +1191,7 @@ RSpec.describe API::Projects do project.each_pair do |k, v| next if %i[ has_external_issue_tracker has_external_wiki issues_enabled merge_requests_enabled wiki_enabled storage_version - container_registry_access_level + container_registry_access_level releases_access_level ].include?(k) expect(json_response[k.to_s]).to eq(v) @@ -1195,6 +1206,7 @@ RSpec.describe API::Projects do expect(project.project_feature.analytics_access_level).to eq(ProjectFeature::DISABLED) expect(project.project_feature.container_registry_access_level).to eq(ProjectFeature::PRIVATE) expect(project.project_feature.security_and_compliance_access_level).to eq(ProjectFeature::PRIVATE) + expect(project.project_feature.releases_access_level).to eq(ProjectFeature::DISABLED) end it 'assigns container_registry_enabled to project', :aggregate_failures do @@ -2333,6 +2345,7 @@ RSpec.describe API::Projects do expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved) expect(json_response['operations_access_level']).to be_present expect(json_response['security_and_compliance_access_level']).to be_present + expect(json_response['releases_access_level']).to be_present end it 'exposes all necessary attributes' do @@ -2402,6 +2415,7 @@ RSpec.describe API::Projects do expect(json_response['builds_access_level']).to be_present expect(json_response['operations_access_level']).to be_present expect(json_response['security_and_compliance_access_level']).to be_present + expect(json_response['releases_access_level']).to be_present expect(json_response).to have_key('emails_disabled') expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions) expect(json_response['remove_source_branch_after_merge']).to be_truthy @@ -2516,7 +2530,7 @@ RSpec.describe API::Projects do 'name' => project.repository.license.name, 'nickname' => project.repository.license.nickname, 'html_url' => project.repository.license.url, - 'source_url' => project.repository.license.meta['source'] + 'source_url' => nil }) end @@ -3386,6 +3400,14 @@ RSpec.describe API::Projects do expect(Project.find_by(path: project[:path]).analytics_access_level).to eq(ProjectFeature::PRIVATE) end + it 'sets releases_access_level', :aggregate_failures do + put api("/projects/#{project.id}", user), params: { releases_access_level: 'private' } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['releases_access_level']).to eq('private') + expect(Project.find_by(path: project[:path]).releases_access_level).to eq(ProjectFeature::PRIVATE) + end + it 'returns 400 when nothing sent' do project_param = {} |