Commit 6c872699 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '28598-narrow-environment-payload-by-using-basic-project-ee' into 'master'

Backport "Simplify project payload exposed on Environment endpoints in V4"

See merge request !1345
parents a35d01e3 2901ffb4
---
title: Narrow environment payload by using basic project details resource
merge_request:
author:
...@@ -63,9 +63,11 @@ changes are in V4: ...@@ -63,9 +63,11 @@ changes are in V4:
- Return 202 with JSON body on async removals on V4 API (DELETE `/projects/:id/repository/merged_branches` and DELETE `/projects/:id`) [!9449](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9449) - Return 202 with JSON body on async removals on V4 API (DELETE `/projects/:id/repository/merged_branches` and DELETE `/projects/:id`) [!9449](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9449)
- `projects/:id/milestones?iid[]=x&iid[]=y` array filter has been renamed to `iids` [!9096](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9096) - `projects/:id/milestones?iid[]=x&iid[]=y` array filter has been renamed to `iids` [!9096](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9096)
- Return basic info about pipeline in `GET /projects/:id/pipelines` [!8875](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8875) - Return basic info about pipeline in `GET /projects/:id/pipelines` [!8875](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8875)
- Simplify project payload exposed on Environment endpoints [!9675](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9675)
#### EE-specific #### EE-specific
- Remove the ProjectGitHook API. Use the ProjectPushRule API instead [!1301](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1301) - Remove the ProjectGitHook API. Use the ProjectPushRule API instead [!1301](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1301)
- Removed `repository_storage` from `PUT /application/settings` and `GET /application/settings` (use `repository_storages` instead) [!1307](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1307) - Removed `repository_storage` from `PUT /application/settings` and `GET /application/settings` (use `repository_storages` instead) [!1307](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1307)
- Removed `elasticsearch_host` and `elasticsearch_port` from `PUT /application/settings` (use `elasticsearch_url` instead) [!1305](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1305) - Removed `elasticsearch_host` and `elasticsearch_port` from `PUT /application/settings` (use `elasticsearch_url` instead) [!1305](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1305)
...@@ -732,7 +732,7 @@ module API ...@@ -732,7 +732,7 @@ module API
end end
class Environment < EnvironmentBasic class Environment < EnvironmentBasic
expose :project, using: Entities::Project expose :project, using: Entities::BasicProjectDetails
end end
class Deployment < Grape::Entity class Deployment < Grape::Entity
......
...@@ -15,6 +15,8 @@ describe API::Environments, api: true do ...@@ -15,6 +15,8 @@ describe API::Environments, api: true do
describe 'GET /projects/:id/environments' do describe 'GET /projects/:id/environments' do
context 'as member of the project' do context 'as member of the project' do
it 'returns project environments' do it 'returns project environments' do
project_data_keys = %w(id http_url_to_repo web_url name name_with_namespace path path_with_namespace)
get api("/projects/#{project.id}/environments", user) get api("/projects/#{project.id}/environments", user)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -23,8 +25,7 @@ describe API::Environments, api: true do ...@@ -23,8 +25,7 @@ describe API::Environments, api: true do
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
expect(json_response.first['name']).to eq(environment.name) expect(json_response.first['name']).to eq(environment.name)
expect(json_response.first['external_url']).to eq(environment.external_url) expect(json_response.first['external_url']).to eq(environment.external_url)
expect(json_response.first['project']['id']).to eq(project.id) expect(json_response.first['project'].keys).to contain_exactly(*project_data_keys)
expect(json_response.first['project']['visibility']).to be_present
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