Commit b59c7e2e authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Allow updating shared_runners_minutes_limit on admin Namespace API

parent e76764ed
---
title: Allow updating shared_runners_minutes_limit on admin Namespace API
merge_request:
author:
......@@ -495,7 +495,7 @@ module API
class Namespace < Grape::Entity
expose :plan, if: lambda { |_, options| options[:current_user] && options[:current_user].admin? }
expose :id, :name, :path, :kind, :full_path
expose :id, :name, :path, :kind, :full_path, :shared_runners_minutes_limit
end
class MemberAccess < Grape::Entity
......
......@@ -25,6 +25,7 @@ module API
end
params do
optional :plan, type: String, desc: "Namespace or Group plan"
optional :shared_runners_minutes_limit, type: Integer, desc: "Pipeline minutes quota for this namespace"
end
put ':id' do
authenticated_as_admin!
......
......@@ -59,18 +59,20 @@ describe API::Namespaces do
describe 'PUT /namespaces/:id' do
context 'when authenticated as admin' do
it 'updates plan using full_path' do
put api("/namespaces/#{group1.full_path}", admin), plan: 'silver'
it 'updates namespace using full_path' do
put api("/namespaces/#{group1.full_path}", admin), plan: 'silver', shared_runners_minutes_limit: 9001
expect(response).to have_http_status(200)
expect(json_response['plan']).to eq('silver')
expect(json_response['shared_runners_minutes_limit']).to eq(9001)
end
it 'updates plan using id' do
put api("/namespaces/#{group1.id}", admin), plan: 'silver'
it 'updates namespace using id' do
put api("/namespaces/#{group1.id}", admin), plan: 'silver', shared_runners_minutes_limit: 9001
expect(response).to have_http_status(200)
expect(json_response['plan']).to eq('silver')
expect(json_response['shared_runners_minutes_limit']).to eq(9001)
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