debian-mirror-gitlab/spec/requests/api/system_hooks_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.2 KiB
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe API::SystemHooks do
2022-08-13 15:12:31 +05:30
let_it_be(:non_admin) { create(:user) }
let_it_be(:admin) { create(:admin) }
let_it_be_with_refind(:hook) { create(:system_hook, url: "http://example.com") }
2019-06-05 12:25:43 +05:30
2022-08-13 15:12:31 +05:30
it_behaves_like 'web-hook API endpoints', '' do
let(:user) { admin }
let(:unauthorized_user) { non_admin }
2014-09-02 18:07:02 +05:30
2022-08-13 15:12:31 +05:30
def scope
SystemHook
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def collection_uri
"/hooks"
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def match_collection_schema
match_response_schema('public_api/v4/system_hooks')
2022-05-07 20:08:51 +05:30
end
2022-08-13 15:12:31 +05:30
def hook_uri(hook_id = hook.id)
"/hooks/#{hook_id}"
2022-05-07 20:08:51 +05:30
end
2022-08-13 15:12:31 +05:30
def match_hook_schema
match_response_schema('public_api/v4/system_hook')
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def event_names
%i[
push_events
tag_push_events
merge_requests_events
repository_update_events
]
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def hook_param_overrides
{}
2017-08-17 22:00:37 +05:30
end
2022-08-13 15:12:31 +05:30
let(:update_params) do
{
push_events: false,
tag_push_events: true
}
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
let(:default_values) do
{ repository_update_events: true }
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
2022-08-13 15:12:31 +05:30
it_behaves_like 'web-hook API endpoints test hook', ''
2014-09-02 18:07:02 +05:30
end
end