diff options
Diffstat (limited to 'spec/requests/api/groups_spec.rb')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 1671a046fdf..8ce9fcc80bf 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -23,7 +23,7 @@ describe API::Groups do it "returns public groups" do get api("/groups") - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(1) @@ -36,7 +36,7 @@ describe API::Groups do it "normal user: returns an array of groups of user1" do get api("/groups", user1) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(1) @@ -47,7 +47,7 @@ describe API::Groups do it "does not include statistics" do get api("/groups", user1), statistics: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.first).not_to include 'statistics' @@ -58,7 +58,7 @@ describe API::Groups do it "admin: returns an array of all groups" do get api("/groups", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(2) @@ -67,7 +67,7 @@ describe API::Groups do it "does not include statistics by default" do get api("/groups", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.first).not_to include('statistics') @@ -87,7 +87,7 @@ describe API::Groups do get api("/groups", admin), statistics: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response) @@ -99,7 +99,7 @@ describe API::Groups do it "returns all groups excluding skipped groups" do get api("/groups", admin), skip_groups: [group2.id] - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(1) @@ -114,7 +114,7 @@ describe API::Groups do get api("/groups", user1), all_available: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(response_groups).to contain_exactly(public_group.name, group1.name) @@ -132,7 +132,7 @@ describe API::Groups do it "sorts by name ascending by default" do get api("/groups", user1) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(response_groups).to eq([group3.name, group1.name]) @@ -141,7 +141,7 @@ describe API::Groups do it "sorts in descending order when passed" do get api("/groups", user1), sort: "desc" - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(response_groups).to eq([group1.name, group3.name]) @@ -150,7 +150,7 @@ describe API::Groups do it "sorts by the order_by param" do get api("/groups", user1), order_by: "path" - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(response_groups).to eq([group1.name, group3.name]) @@ -163,7 +163,7 @@ describe API::Groups do get api('/groups', user2), owned: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.length).to eq(1) @@ -176,12 +176,12 @@ describe API::Groups do context 'when unauthenticated' do it 'returns 404 for a private group' do get api("/groups/#{group2.id}") - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'returns 200 for a public group' do get api("/groups/#{group1.id}") - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end end @@ -192,7 +192,7 @@ describe API::Groups do get api("/groups/#{group1.id}", user1) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['id']).to eq(group1.id) expect(json_response['name']).to eq(group1.name) expect(json_response['path']).to eq(group1.path) @@ -214,13 +214,13 @@ describe API::Groups do it "does not return a non existing group" do get api("/groups/1328", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "does not return a group not attached to user1" do get api("/groups/#{group2.id}", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -228,14 +228,14 @@ describe API::Groups do it "returns any existing group" do get api("/groups/#{group2.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(group2.name) end it "does not return a non existing group" do get api("/groups/1328", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -243,20 +243,20 @@ describe API::Groups do it 'returns any existing group' do get api("/groups/#{group1.path}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(group1.name) end it 'does not return a non existing group' do get api('/groups/unknown', admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'does not return a group not attached to user1' do get api("/groups/#{group2.path}", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -268,7 +268,7 @@ describe API::Groups do it 'updates the group' do put api("/groups/#{group1.id}", user1), name: new_group_name, request_access_enabled: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(new_group_name) expect(json_response['request_access_enabled']).to eq(true) end @@ -276,7 +276,7 @@ describe API::Groups do it 'returns 404 for a non existing group' do put api('/groups/1328', user1), name: new_group_name - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -284,7 +284,7 @@ describe API::Groups do it 'updates the group' do put api("/groups/#{group1.id}", admin), name: new_group_name - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['name']).to eq(new_group_name) end end @@ -293,7 +293,7 @@ describe API::Groups do it 'does not updates the group' do put api("/groups/#{group1.id}", user2), name: new_group_name - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -301,7 +301,7 @@ describe API::Groups do it 'returns 404 when trying to update the group' do put api("/groups/#{group2.id}", user1), name: new_group_name - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -311,7 +311,7 @@ describe API::Groups do it "returns the group's projects" do get api("/groups/#{group1.id}/projects", user1) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response.length).to eq(2) project_names = json_response.map { |proj| proj['name'] } @@ -322,7 +322,7 @@ describe API::Groups do it "returns the group's projects with simple representation" do get api("/groups/#{group1.id}/projects", user1), simple: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response.length).to eq(2) project_names = json_response.map { |proj| proj['name'] } @@ -335,7 +335,7 @@ describe API::Groups do get api("/groups/#{group1.id}/projects", user1), visibility: 'public' - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an(Array) expect(json_response.length).to eq(1) @@ -345,13 +345,13 @@ describe API::Groups do it "does not return a non existing group" do get api("/groups/1328/projects", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "does not return a group not attached to user1" do get api("/groups/#{group2.id}/projects", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "only returns projects to which user has access" do @@ -359,7 +359,7 @@ describe API::Groups do get api("/groups/#{group1.id}/projects", user3) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response.length).to eq(1) expect(json_response.first['name']).to eq(project3.name) @@ -370,7 +370,7 @@ describe API::Groups do get api("/groups/#{project2.group.id}/projects", user3), owned: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response.length).to eq(1) expect(json_response.first['name']).to eq(project2.name) end @@ -380,7 +380,7 @@ describe API::Groups do get api("/groups/#{group1.id}/projects", user1), starred: true - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response.length).to eq(1) expect(json_response.first['name']).to eq(project1.name) end @@ -390,7 +390,7 @@ describe API::Groups do it "returns any existing group" do get api("/groups/#{group2.id}/projects", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response.length).to eq(1) expect(json_response.first['name']).to eq(project2.name) @@ -399,7 +399,7 @@ describe API::Groups do it "does not return a non existing group" do get api("/groups/1328/projects", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -407,7 +407,7 @@ describe API::Groups do it 'returns any existing group' do get api("/groups/#{group1.path}/projects", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers project_names = json_response.map { |proj| proj['name'] } expect(project_names).to match_array([project1.name, project3.name]) @@ -416,13 +416,13 @@ describe API::Groups do it 'does not return a non existing group' do get api('/groups/unknown/projects', admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it 'does not return a group not attached to user1' do get api("/groups/#{group2.path}/projects", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -432,7 +432,7 @@ describe API::Groups do it "does not create group" do post api("/groups", user1), attributes_for(:group) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end context 'as owner', :nested_groups do @@ -443,7 +443,7 @@ describe API::Groups do it 'can create subgroups' do post api("/groups", user1), parent_id: group2.id, name: 'foo', path: 'foo' - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end end @@ -455,7 +455,7 @@ describe API::Groups do it 'cannot create subgroups' do post api("/groups", user1), parent_id: group2.id, name: 'foo', path: 'foo' - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end end @@ -466,7 +466,7 @@ describe API::Groups do post api("/groups", user3), group - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["name"]).to eq(group[:name]) expect(json_response["path"]).to eq(group[:path]) @@ -481,7 +481,7 @@ describe API::Groups do post api("/groups", user3), group - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response["full_path"]).to eq("#{parent.path}/#{group[:path]}") expect(json_response["parent_id"]).to eq(parent.id) @@ -490,20 +490,20 @@ describe API::Groups do it "does not create group, duplicate" do post api("/groups", user3), { name: 'Duplicate Test', path: group2.path } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(response.message).to eq("Bad Request") end it "returns 400 bad request error if name not given" do post api("/groups", user3), { path: group2.path } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end it "returns 400 bad request error if path not given" do post api("/groups", user3), { name: 'test' } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end end end @@ -513,7 +513,7 @@ describe API::Groups do it "removes group" do delete api("/groups/#{group1.id}", user1) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end it_behaves_like '412 response' do @@ -526,19 +526,19 @@ describe API::Groups do delete api("/groups/#{group1.id}", user3) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it "does not remove a non existing group" do delete api("/groups/1328", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end it "does not remove a group not attached to user1" do delete api("/groups/#{group2.id}", user1) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end @@ -546,13 +546,13 @@ describe API::Groups do it "removes any existing group" do delete api("/groups/#{group2.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end it "does not remove a non existing group" do delete api("/groups/1328", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -570,7 +570,7 @@ describe API::Groups do it "does not transfer project to group" do post api("/groups/#{group1.id}/projects/#{project.id}", user2) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end end @@ -578,7 +578,7 @@ describe API::Groups do it "transfers project to group" do post api("/groups/#{group1.id}/projects/#{project.id}", admin) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end context 'when using project path in URL' do @@ -586,7 +586,7 @@ describe API::Groups do it "transfers project to group" do post api("/groups/#{group1.id}/projects/#{project_path}", admin) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end end @@ -594,7 +594,7 @@ describe API::Groups do it "does not transfer project to group" do post api("/groups/#{group1.id}/projects/nogroup%2Fnoproject", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end @@ -604,7 +604,7 @@ describe API::Groups do it "transfers project to group" do post api("/groups/#{group1.path}/projects/#{project_path}", admin) - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) end end @@ -612,7 +612,7 @@ describe API::Groups do it "does not transfer project to group" do post api("/groups/noexist/projects/#{project_path}", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) end end end |