Commit e1cc0fd5 authored by Rémy Coutable's avatar Rémy Coutable

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

Simplify project payload exposed on Environment endpoints in V4

Closes #28598

See merge request !9675
parents ef24c9ef fa0c0bb0
---
title: Narrow environment payload by using basic project details resource
merge_request:
author:
......@@ -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)
- `POST /projects/:id/trigger/builds` to `POST /projects/:id/trigger/pipeline`
- 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
end
class Environment < EnvironmentBasic
expose :project, using: Entities::Project
expose :project, using: Entities::BasicProjectDetails
end
class Deployment < Grape::Entity
......
......@@ -15,6 +15,8 @@ describe API::Environments, api: true do
describe 'GET /projects/:id/environments' do
context 'as member of the project' 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)
expect(response).to have_http_status(200)
......@@ -23,8 +25,7 @@ describe API::Environments, api: true do
expect(json_response.size).to eq(1)
expect(json_response.first['name']).to eq(environment.name)
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']['visibility']).to be_present
expect(json_response.first['project'].keys).to contain_exactly(*project_data_keys)
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