Commit d5f70604 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Rename `/take` to `/take_ownership`, expose `owner` in `v3`.

parent 01f99bd2
......@@ -128,7 +128,7 @@ curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form descrip
Update an owner of a project trigger.
```
POST /projects/:id/triggers/:trigger_id/take
POST /projects/:id/triggers/:trigger_id/take_ownership
```
| Attribute | Type | required | Description |
......@@ -136,7 +136,7 @@ POST /projects/:id/triggers/:trigger_id/take
| `trigger_id` | integer | yes | The trigger id |
```
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take"
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take_ownership"
```
```json
......
......@@ -114,7 +114,7 @@ module API
params do
requires :trigger_id, type: Integer, desc: 'The trigger ID'
end
post ':id/triggers/:trigger_id/take' do
post ':id/triggers/:trigger_id/take_ownership' do
authenticate!
authorize! :admin_build, user_project
......
......@@ -189,6 +189,7 @@ module API
class Trigger < Grape::Entity
expose :token, :created_at, :updated_at, :deleted_at, :last_used
expose :owner, using: Entities::UserBasic
end
class TriggerRequest < Grape::Entity
......
......@@ -238,12 +238,12 @@ describe API::Triggers do
end
end
describe 'POST /projects/:id/triggers/:trigger_id/take' do
describe 'POST /projects/:id/triggers/:trigger_id/take_ownership' do
context 'authenticated user with valid permissions' do
it 'updates owner' do
expect(trigger.owner).to be_nil
post api("/projects/#{project.id}/triggers/#{trigger.id}/take", user)
post api("/projects/#{project.id}/triggers/#{trigger.id}/take_ownership", user)
expect(response).to have_http_status(200)
expect(json_response).to include('owner')
......@@ -253,7 +253,7 @@ describe API::Triggers do
context 'authenticated user with invalid permissions' do
it 'does not update owner' do
post api("/projects/#{project.id}/triggers/#{trigger.id}/take", user2)
post api("/projects/#{project.id}/triggers/#{trigger.id}/take_ownership", user2)
expect(response).to have_http_status(403)
end
......@@ -261,7 +261,7 @@ describe API::Triggers do
context 'unauthenticated user' do
it 'does not update owner' do
post api("/projects/#{project.id}/triggers/#{trigger.id}/take")
post api("/projects/#{project.id}/triggers/#{trigger.id}/take_ownership")
expect(response).to have_http_status(401)
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