diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-05-30 21:55:18 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-05-30 21:55:18 +0000 |
commit | 09916aea40a50cfa0bcc4a74ae7367c3bd18cb96 (patch) | |
tree | eca91a2c3b417182754dd4b6b4e8ff69104455dd /spec | |
parent | 9302485eae6ffa663e01269e385ba4f4a05a0df7 (diff) | |
parent | 9cd70ec1cda8d36248df27b18fe6f1badbd09e84 (diff) | |
download | gitlab-ce-09916aea40a50cfa0bcc4a74ae7367c3bd18cb96.tar.gz |
Merge branch 'if-10137-ee_specific_lines_projects_api' into 'master'
CE port of Move EE specific lines in API::Projects
See merge request gitlab-org/gitlab-ce!28596
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 16d306f39cd..799e84e83c1 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1025,7 +1025,54 @@ describe API::Projects do end end - context 'when authenticated' do + context 'when authenticated as an admin' do + it 'returns a project by id' do + project + project_member + group = create(:group) + link = create(:project_group_link, project: project, group: group) + + get api("/projects/#{project.id}", admin) + + expect(response).to have_gitlab_http_status(200) + expect(json_response['id']).to eq(project.id) + expect(json_response['description']).to eq(project.description) + expect(json_response['default_branch']).to eq(project.default_branch) + expect(json_response['tag_list']).to be_an Array + expect(json_response['archived']).to be_falsey + expect(json_response['visibility']).to be_present + expect(json_response['ssh_url_to_repo']).to be_present + expect(json_response['http_url_to_repo']).to be_present + expect(json_response['web_url']).to be_present + expect(json_response['owner']).to be_a Hash + expect(json_response['name']).to eq(project.name) + expect(json_response['path']).to be_present + expect(json_response['issues_enabled']).to be_present + expect(json_response['merge_requests_enabled']).to be_present + expect(json_response['wiki_enabled']).to be_present + expect(json_response['jobs_enabled']).to be_present + expect(json_response['snippets_enabled']).to be_present + expect(json_response['container_registry_enabled']).to be_present + expect(json_response['created_at']).to be_present + expect(json_response['last_activity_at']).to be_present + expect(json_response['shared_runners_enabled']).to be_present + expect(json_response['creator_id']).to be_present + expect(json_response['namespace']).to be_present + expect(json_response['avatar_url']).to be_nil + expect(json_response['star_count']).to be_present + expect(json_response['forks_count']).to be_present + expect(json_response['public_jobs']).to be_present + expect(json_response['shared_with_groups']).to be_an Array + expect(json_response['shared_with_groups'].length).to eq(1) + expect(json_response['shared_with_groups'][0]['group_id']).to eq(group.id) + expect(json_response['shared_with_groups'][0]['group_name']).to eq(group.name) + expect(json_response['shared_with_groups'][0]['group_access_level']).to eq(link.group_access) + expect(json_response['only_allow_merge_if_pipeline_succeeds']).to eq(project.only_allow_merge_if_pipeline_succeeds) + expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved) + end + end + + context 'when authenticated as a regular user' do before do project project_member |