Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b36116f9
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 搜索 >>
提交
b36116f9
编写于
2月 16, 2016
作者:
T
Tomasz Maczukin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move :runner_id param to POST body when enabling specific runner in project
上级
dc182dc5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
9 deletion
+17
-9
lib/api/runners.rb
lib/api/runners.rb
+3
-1
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+14
-8
未找到文件。
lib/api/runners.rb
浏览文件 @
b36116f9
...
...
@@ -91,7 +91,9 @@ module API
# runner_id (required) - The ID of the runner
# Example Request:
# POST /projects/:id/runners/:runner_id
post
':id/runners/:runner_id'
do
post
':id/runners'
do
required_attributes!
[
:runner_id
]
runner
=
get_runner
(
params
[
:runner_id
])
authenticate_enable_runner!
(
runner
)
Ci
::
RunnerProject
.
create
(
runner:
runner
,
project:
user_project
)
...
...
spec/requests/api/runners_spec.rb
浏览文件 @
b36116f9
...
...
@@ -337,27 +337,27 @@ describe API::API, api: true do
end
end
describe
'POST /projects/:id/runners
/:runner_id
'
do
describe
'POST /projects/:id/runners'
do
let!
(
:specific_runner2
)
{
create
(
:ci_specific_runner
)
}
let!
(
:specific_runner2_project
)
{
create
(
:ci_runner_project
,
runner:
specific_runner2
,
project:
project2
)
}
context
'authorized user'
do
it
'should enable specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
specific_runner2
.
id
}
"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
user
),
runner_id:
specific_runner2
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
.
status
).
to
eq
(
201
)
end
it
'should avoid changes when enabling already enabled runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
specific_runner
.
id
}
"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
user
),
runner_id:
specific_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
201
)
end
it
'should not enable shared runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
shared_runner
.
id
}
"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
user
),
runner_id:
shared_runner
.
id
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -365,7 +365,7 @@ describe API::API, api: true do
context
'user is admin'
do
it
'should enable any specific runner'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
unused_specific_runner
.
id
}
"
,
admin
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
admin
),
runner_id:
unused_specific_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
expect
(
response
.
status
).
to
eq
(
201
)
end
...
...
@@ -373,16 +373,22 @@ describe API::API, api: true do
context
'user is not admin'
do
it
'should not enable runner without access to'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
unused_specific_runner
.
id
}
"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
user
),
runner_id:
unused_specific_runner
.
id
expect
(
response
.
status
).
to
eq
(
403
)
end
end
it
'should raise an error when no runner_id param is provided'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
admin
)
expect
(
response
.
status
).
to
eq
(
400
)
end
end
context
'authorized user without permissions'
do
it
'should not enable runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
specific_runner2
.
id
}
"
,
user2
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
,
user2
),
runner_id:
specific_runner2
.
id
expect
(
response
.
status
).
to
eq
(
403
)
end
...
...
@@ -390,7 +396,7 @@ describe API::API, api: true do
context
'unauthorized user'
do
it
'should not enable runner'
do
post
api
(
"/projects/
#{
project
.
id
}
/runners
/
#{
specific_runner2
.
id
}
"
)
post
api
(
"/projects/
#{
project
.
id
}
/runners
"
),
runner_id:
specific_runner2
.
id
expect
(
response
.
status
).
to
eq
(
401
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录