Commit db345ff8 authored by Blair Lunceford's avatar Blair Lunceford

add api support

parent 0844cf9d
......@@ -30,7 +30,8 @@ module API
optional :disable_overriding_approvers_per_merge_request, type: Boolean, desc: 'Should MRs be able to override approvers and approval count'
optional :merge_requests_author_approval, type: Boolean, desc: 'Should merge request authors be able to self approve merge requests; `true` means authors cannot self approve'
optional :merge_requests_disable_committers_approval, type: Boolean, desc: 'Should committers be able to self approve merge requests'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval, :merge_requests_disable_committers_approval
optional :require_password_to_approve, type: Boolean, desc: 'Should approvers authenticate via password before adding approval'
at_least_one_of :approvals_before_merge, :reset_approvals_on_push, :disable_overriding_approvers_per_merge_request, :merge_requests_author_approval, :merge_requests_disable_committers_approval, :require_password_to_approve
end
post '/' do
project_params = declared(params, include_missing: false, include_parent_namespaces: false)
......
......@@ -506,6 +506,7 @@ module EE
expose :disable_overriding_approvers_per_merge_request
expose :merge_requests_author_approval
expose :merge_requests_disable_committers_approval
expose :require_password_to_approve
end
class Approvals < Grape::Entity
......
......@@ -6,6 +6,7 @@
"reset_approvals_on_push": { "type": "boolean" },
"merge_requests_author_approval": { "type": ["boolean", "null"] },
"merge_requests_disable_committers_approval": { "type": ["boolean", "null"] },
"require_password_to_approve": { "type": ["boolean", "null"] },
"approvers": {
"type": "array",
"items": {
......
......@@ -69,6 +69,7 @@ describe API::ProjectApprovals do
project.disable_overriding_approvers_per_merge_request = true
project.merge_requests_author_approval = false
project.merge_requests_disable_committers_approval = true
project.require_password_to_approve = true
project.save
settings = {
......@@ -76,7 +77,8 @@ describe API::ProjectApprovals do
reset_approvals_on_push: true,
disable_overriding_approvers_per_merge_request: false,
merge_requests_author_approval: true,
merge_requests_disable_committers_approval: false
merge_requests_disable_committers_approval: false,
require_password_to_approve: true
}
post api(url, current_user), params: settings
......
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