Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7308a9be
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,发现更多精彩内容 >>
提交
7308a9be
编写于
8月 09, 2018
作者:
R
Robert Schilling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
API: Add shared project's expiration date
上级
cc9764ac
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
2 deletion
+27
-2
changelogs/unreleased/api-shared_group_expires-at.yml
changelogs/unreleased/api-shared_group_expires-at.yml
+5
-0
doc/api/groups.md
doc/api/groups.md
+4
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/factories/project_group_links.rb
spec/factories/project_group_links.rb
+1
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+16
-0
未找到文件。
changelogs/unreleased/api-shared_group_expires-at.yml
0 → 100644
浏览文件 @
7308a9be
---
title
:
'
API:
Add
expiration
date
for
shared
projects
to
the
project
entity'
merge_request
:
21104
author
:
Robert Schilling
type
:
added
doc/api/groups.md
浏览文件 @
7308a9be
...
...
@@ -351,12 +351,14 @@ Example response:
{
"group_id"
:
4
,
"group_name"
:
"Twitter"
,
"group_access_level"
:
30
"group_access_level"
:
30
,
"expires_at"
:
null
},
{
"group_id"
:
3
,
"group_name"
:
"Gitlab Org"
,
"group_access_level"
:
10
"group_access_level"
:
10
,
"expires_at"
:
"2018-08-14"
}
]
}
...
...
lib/api/entities.rb
浏览文件 @
7308a9be
...
...
@@ -91,6 +91,7 @@ module API
group_link
.
group
.
name
end
expose
:group_access
,
as: :group_access_level
expose
:expires_at
end
class
ProjectIdentity
<
Grape
::
Entity
...
...
spec/factories/project_group_links.rb
浏览文件 @
7308a9be
...
...
@@ -2,5 +2,6 @@ FactoryBot.define do
factory
:project_group_link
do
project
group
expires_at
nil
end
end
spec/requests/api/projects_spec.rb
浏览文件 @
7308a9be
...
...
@@ -914,12 +914,28 @@ describe API::Projects do
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_name'
]).
to
eq
(
group
.
name
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_access_level'
]).
to
eq
(
link
.
group_access
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'expires_at'
]).
to
be_nil
expect
(
json_response
[
'only_allow_merge_if_pipeline_succeeds'
]).
to
eq
(
project
.
only_allow_merge_if_pipeline_succeeds
)
expect
(
json_response
[
'only_allow_merge_if_all_discussions_are_resolved'
]).
to
eq
(
project
.
only_allow_merge_if_all_discussions_are_resolved
)
expect
(
json_response
[
'merge_method'
]).
to
eq
(
project
.
merge_method
.
to_s
)
expect
(
json_response
[
'readme_url'
]).
to
eq
(
project
.
readme_url
)
end
it
'returns a group link with expiration date'
do
group
=
create
(
:group
)
expires_at
=
5
.
days
.
from_now
.
to_date
link
=
create
(
:project_group_link
,
project:
project
,
group:
group
,
expires_at:
expires_at
)
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
expect
(
json_response
[
'shared_with_groups'
]).
to
be_an
Array
expect
(
json_response
[
'shared_with_groups'
].
length
).
to
eq
(
1
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_name'
]).
to
eq
(
group
.
name
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_access_level'
]).
to
eq
(
link
.
group_access
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'expires_at'
]).
to
eq
(
expires_at
.
to_s
)
end
it
'returns a project by path name'
do
get
api
(
"/projects/
#{
project
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录