Commit fa0c0bb0 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Narrow environment payload by using basic project details resource

parent b63c41e1
---
title: Narrow environment payload by using basic project details resource
merge_request:
author:
...@@ -68,3 +68,5 @@ changes are in V4: ...@@ -68,3 +68,5 @@ changes are in V4:
- Rename Build Triggers to be Pipeline Triggers API [!9713](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9713) - Rename Build Triggers to be Pipeline Triggers API [!9713](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9713)
- `POST /projects/:id/trigger/builds` to `POST /projects/:id/trigger/pipeline` - `POST /projects/:id/trigger/builds` to `POST /projects/:id/trigger/pipeline`
- Require description when creating a new trigger `POST /projects/:id/triggers` - Require description when creating a new trigger `POST /projects/:id/triggers`
- Simplify project payload exposed on Environment endpoints [!9675](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9675)
...@@ -671,7 +671,7 @@ module API ...@@ -671,7 +671,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