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

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

70 lines
1.6 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::ProjectHooks, 'ProjectHooks' do
2022-08-13 15:12:31 +05:30
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
2015-12-23 02:04:40 +05:30
create(:project_hook,
2016-09-13 17:45:13 +05:30
:all_events_enabled,
project: project,
url: 'http://example.com',
2018-11-20 20:47:30 +05:30
enable_ssl_verification: true,
push_events_branch_filter: 'master')
2015-12-23 02:04:40 +05:30
end
2014-09-02 18:07:02 +05:30
2022-08-13 15:12:31 +05:30
before_all do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2018-03-17 18:26:18 +05:30
project.add_developer(user3)
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
it_behaves_like 'web-hook API endpoints', '/projects/:id' do
let(:unauthorized_user) { user3 }
2014-09-02 18:07:02 +05:30
2022-08-13 15:12:31 +05:30
def scope
project.hooks
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def collection_uri
"/projects/#{project.id}/hooks"
2017-08-17 22:00:37 +05:30
end
2022-08-13 15:12:31 +05:30
def match_collection_schema
match_response_schema('public_api/v4/project_hooks')
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def hook_uri(hook_id = hook.id)
"/projects/#{project.id}/hooks/#{hook_id}"
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
def match_hook_schema
match_response_schema('public_api/v4/project_hook')
2018-11-20 20:47:30 +05:30
end
2022-08-13 15:12:31 +05:30
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
]
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
let(:default_values) do
{ push_events: true, confidential_note_events: nil }
2014-09-02 18:07:02 +05:30
end
2022-08-13 15:12:31 +05:30
it_behaves_like 'web-hook API endpoints with branch-filter', '/projects/:id'
2014-09-02 18:07:02 +05:30
end
end