blob: 9d94b5437b78992dbb25e111e80986d10046c0d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::ProjectHooks, 'ProjectHooks', feature_category: :webhooks do
let_it_be(:user) { create(:user) }
let_it_be(:user3) { create(:user) }
let_it_be(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
let_it_be_with_refind(:hook) do
create(:project_hook,
:all_events_enabled,
project: project,
url: 'http://example.com',
enable_ssl_verification: true,
push_events_branch_filter: 'master')
end
before_all do
project.add_maintainer(user)
project.add_developer(user3)
end
it_behaves_like 'web-hook API endpoints', '/projects/:id' do
let(:unauthorized_user) { user3 }
def scope
project.hooks
end
def collection_uri
"/projects/#{project.id}/hooks"
end
def match_collection_schema
match_response_schema('public_api/v4/project_hooks')
end
def hook_uri(hook_id = hook.id)
"/projects/#{project.id}/hooks/#{hook_id}"
end
def match_hook_schema
match_response_schema('public_api/v4/project_hook')
end
def event_names
%i[
push_events
tag_push_events
merge_requests_events
issues_events
confidential_issues_events
note_events
confidential_note_events
pipeline_events
wiki_page_events
job_events
deployment_events
releases_events
emoji_events
]
end
let(:default_values) do
{ push_events: true, confidential_note_events: nil }
end
it_behaves_like 'web-hook API endpoints with branch-filter', '/projects/:id'
end
end
|