Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5b29f066
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,发现更多精彩内容 >>
提交
5b29f066
编写于
2月 13, 2019
作者:
R
Robert Schilling
提交者:
Rémy Coutable
2月 13, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Only require one parameter when updating a Wiki via the API
上级
bd17881b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
17 deletion
+41
-17
changelogs/unreleased/39676-wiki-api-problems-on-update-parameters-and-500-error.yml
...-wiki-api-problems-on-update-parameters-and-500-error.yml
+5
-0
lib/api/wikis.rb
lib/api/wikis.rb
+8
-5
spec/requests/api/wikis_spec.rb
spec/requests/api/wikis_spec.rb
+28
-12
未找到文件。
changelogs/unreleased/39676-wiki-api-problems-on-update-parameters-and-500-error.yml
0 → 100644
浏览文件 @
5b29f066
---
title
:
'
API:
Require
only
one
parameter
when
updating
a
wiki'
merge_request
:
25191
author
:
Robert Schilling
type
:
fixed
lib/api/wikis.rb
浏览文件 @
5b29f066
...
...
@@ -11,9 +11,7 @@ module API
}
end
params
:wiki_page_params
do
requires
:content
,
type:
String
,
desc:
'Content of a wiki page'
requires
:title
,
type:
String
,
desc:
'Title of a wiki page'
params
:common_wiki_page_params
do
optional
:format
,
type:
String
,
values:
ProjectWiki
::
MARKUPS
.
values
.
map
(
&
:to_s
),
...
...
@@ -54,7 +52,9 @@ module API
success
Entities
::
WikiPage
end
params
do
use
:wiki_page_params
requires
:title
,
type:
String
,
desc:
'Title of a wiki page'
requires
:content
,
type:
String
,
desc:
'Content of a wiki page'
use
:common_wiki_page_params
end
post
':id/wikis'
do
authorize!
:create_wiki
,
user_project
...
...
@@ -72,7 +72,10 @@ module API
success
Entities
::
WikiPage
end
params
do
use
:wiki_page_params
optional
:title
,
type:
String
,
desc:
'Title of a wiki page'
optional
:content
,
type:
String
,
desc:
'Content of a wiki page'
use
:common_wiki_page_params
at_least_one_of
:content
,
:title
,
:format
end
put
':id/wikis/:slug'
do
authorize!
:create_wiki
,
user_project
...
...
spec/requests/api/wikis_spec.rb
浏览文件 @
5b29f066
...
...
@@ -100,6 +100,8 @@ describe API::Wikis do
shared_examples_for
'updates wiki page'
do
it
'updates the wiki page'
do
put
(
api
(
url
,
user
),
params:
payload
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
4
)
expect
(
json_response
.
keys
).
to
match_array
(
expected_keys_with_content
)
...
...
@@ -107,6 +109,16 @@ describe API::Wikis do
expect
(
json_response
[
'slug'
]).
to
eq
(
payload
[
:title
].
tr
(
' '
,
'-'
))
expect
(
json_response
[
'title'
]).
to
eq
(
payload
[
:title
])
end
[
:title
,
:content
,
:format
].
each
do
|
part
|
it
"it updates with wiki with missing
#{
part
}
"
do
payload
.
delete
(
part
)
put
(
api
(
url
,
user
),
params:
payload
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
end
shared_examples_for
'403 Forbidden'
do
...
...
@@ -528,8 +540,6 @@ describe API::Wikis do
context
'when user is developer'
do
before
do
project
.
add_developer
(
user
)
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'updates wiki page'
...
...
@@ -537,6 +547,10 @@ describe API::Wikis do
context
'when page is not existing'
do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/unknown"
}
before
do
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'404 Wiki Page Not Found'
end
end
...
...
@@ -544,8 +558,6 @@ describe API::Wikis do
context
'when user is maintainer'
do
before
do
project
.
add_maintainer
(
user
)
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'updates wiki page'
...
...
@@ -553,6 +565,10 @@ describe API::Wikis do
context
'when page is not existing'
do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/unknown"
}
before
do
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'404 Wiki Page Not Found'
end
end
...
...
@@ -572,8 +588,6 @@ describe API::Wikis do
context
'when user is developer'
do
before
do
project
.
add_developer
(
user
)
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'updates wiki page'
...
...
@@ -581,6 +595,10 @@ describe API::Wikis do
context
'when page is not existing'
do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/unknown"
}
before
do
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'404 Wiki Page Not Found'
end
end
...
...
@@ -588,8 +606,6 @@ describe API::Wikis do
context
'when user is maintainer'
do
before
do
project
.
add_maintainer
(
user
)
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'updates wiki page'
...
...
@@ -597,6 +613,10 @@ describe API::Wikis do
context
'when page is not existing'
do
let
(
:url
)
{
"/projects/
#{
project
.
id
}
/wikis/unknown"
}
before
do
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'404 Wiki Page Not Found'
end
end
...
...
@@ -605,10 +625,6 @@ describe API::Wikis do
context
'when wiki belongs to a group project'
do
let
(
:project
)
{
create
(
:project
,
:wiki_repo
,
namespace:
group
)
}
before
do
put
(
api
(
url
,
user
),
params:
payload
)
end
include_examples
'updates wiki page'
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录