Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
869bab9d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
869bab9d
编写于
9月 24, 2015
作者:
B
Ben Boeckel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hooks: improve tests for hook API
上级
eb912a53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
1 deletion
+27
-1
CHANGELOG
CHANGELOG
+1
-0
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+26
-1
未找到文件。
CHANGELOG
浏览文件 @
869bab9d
...
...
@@ -9,6 +9,7 @@ v 8.1.0 (unreleased)
- Show CI status on commit page
- Show CI status on Your projects page and Starred projects page
- Remove "Continuous Integration" page from dashboard
- Add notes and SSL verification entries to hook APIs (Ben Boeckel)
v 8.0.2 (unreleased)
- Skip check_initd_configured_correctly on omnibus installs
...
...
spec/requests/api/project_hooks_spec.rb
浏览文件 @
869bab9d
...
...
@@ -5,7 +5,7 @@ describe API::API, 'ProjectHooks', api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:hook
)
{
create
(
:project_hook
,
project:
project
,
url:
"http://example.com"
)
}
let!
(
:hook
)
{
create
(
:project_hook
,
project:
project
,
url:
"http://example.com"
,
push_events:
true
,
merge_requests_events:
true
,
tag_push_events:
true
,
issues_events:
true
,
note_events:
true
,
enable_ssl_verification:
true
)
}
before
do
project
.
team
<<
[
user
,
:master
]
...
...
@@ -21,6 +21,12 @@ describe API::API, 'ProjectHooks', api: true do
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
count
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'url'
]).
to
eq
(
"http://example.com"
)
expect
(
json_response
.
first
[
'issues_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'push_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'merge_requests_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'tag_push_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'note_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'enable_ssl_verification'
]).
to
eq
(
true
)
end
end
...
...
@@ -38,6 +44,12 @@ describe API::API, 'ProjectHooks', api: true do
get
api
(
"/projects/
#{
project
.
id
}
/hooks/
#{
hook
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'url'
]).
to
eq
(
hook
.
url
)
expect
(
json_response
[
'issues_events'
]).
to
eq
(
hook
.
issues_events
)
expect
(
json_response
[
'push_events'
]).
to
eq
(
hook
.
push_events
)
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
end
it
"should return a 404 error if hook id is not available"
do
...
...
@@ -65,6 +77,13 @@ describe API::API, 'ProjectHooks', api: true do
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
url:
"http://example.com"
,
issues_events:
true
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'url'
]).
to
eq
(
'http://example.com'
)
expect
(
json_response
[
'issues_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'push_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
true
)
end
it
"should return a 400 error if url not given"
do
...
...
@@ -84,6 +103,12 @@ describe API::API, 'ProjectHooks', api: true do
url:
'http://example.org'
,
push_events:
false
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'url'
]).
to
eq
(
'http://example.org'
)
expect
(
json_response
[
'issues_events'
]).
to
eq
(
hook
.
issues_events
)
expect
(
json_response
[
'push_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
end
it
"should return 404 error if hook id not found"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录