Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
ad2743df
提交
ad2743df
编辑于
4 years ago
作者:
Justin Sleep
提交者:
Rémy Coutable
4 years ago
浏览文件
操作
下载
补丁
差异文件
Fix archived parameter for Group API's projects endpoint
上级
dba80652
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
3
隐藏空白变更内容
行内
左右并排
显示
3 个更改的文件
changelogs/unreleased/fix-group-api-archived.yml
+5
-0
5 个添加, 0 个删除
changelogs/unreleased/fix-group-api-archived.yml
lib/api/groups.rb
+2
-2
2 个添加, 2 个删除
lib/api/groups.rb
spec/requests/api/groups_spec.rb
+41
-9
41 个添加, 9 个删除
spec/requests/api/groups_spec.rb
有
48 个添加
和
11 个删除
changelogs/unreleased/fix-group-api-archived.yml
0 → 100644
+
5
−
0
浏览文件 @
ad2743df
---
title
:
Remove default "archived" parameter value from Groups API's projects endpoint
merge_request
:
34018
author
:
Justin Sleep
type
:
fixed
此差异已折叠。
点击以展开。
lib/api/groups.rb
+
2
−
2
浏览文件 @
ad2743df
...
...
@@ -218,7 +218,7 @@ def delete_group(group)
success
Entities
::
Project
end
params
do
optional
:archived
,
type:
Boolean
,
default:
false
,
desc:
'Limit by archived status'
optional
:archived
,
type:
Boolean
,
desc:
'Limit by archived status'
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'Limit by visibility'
optional
:search
,
type:
String
,
desc:
'Return list of authorized projects matching the search criteria'
...
...
@@ -255,7 +255,7 @@ def delete_group(group)
success
Entities
::
Project
end
params
do
optional
:archived
,
type:
Boolean
,
default:
false
,
desc:
'Limit by archived status'
optional
:archived
,
type:
Boolean
,
desc:
'Limit by archived status'
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'Limit by visibility'
optional
:search
,
type:
String
,
desc:
'Return list of authorized projects matching the search criteria'
...
...
此差异已折叠。
点击以展开。
spec/requests/api/groups_spec.rb
+
41
−
9
浏览文件 @
ad2743df
...
...
@@ -15,6 +15,7 @@
let_it_be
(
:project1
)
{
create
(
:project
,
namespace:
group1
)
}
let_it_be
(
:project2
)
{
create
(
:project
,
namespace:
group2
)
}
let_it_be
(
:project3
)
{
create
(
:project
,
namespace:
group1
,
path:
'test'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
}
let_it_be
(
:archived_project
)
{
create
(
:project
,
namespace:
group1
,
archived:
true
)
}
before
do
group1
.
add_owner
(
user1
)
...
...
@@ -471,7 +472,7 @@ def response_project_ids(json_response, key)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_access_level'
]).
to
eq
(
link
.
group_access
)
expect
(
json_response
[
'shared_with_groups'
][
0
]).
to
have_key
(
'expires_at'
)
expect
(
json_response
[
'projects'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
3
)
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
expect
(
json_response
[
'shared_projects'
].
length
).
to
eq
(
1
)
expect
(
json_response
[
'shared_projects'
][
0
][
'id'
]).
to
eq
(
project
.
id
)
...
...
@@ -696,7 +697,7 @@ def make_upload_request
expect
(
json_response
[
'parent_id'
]).
to
eq
(
nil
)
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'projects'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
3
)
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
expect
(
json_response
[
'shared_projects'
].
length
).
to
eq
(
0
)
expect
(
json_response
[
'default_branch_protection'
]).
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
...
...
@@ -822,20 +823,51 @@ def make_upload_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
length
).
to
eq
(
3
)
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
,
archived_project
.
name
])
expect
(
json_response
.
first
[
'visibility'
]).
to
be_present
end
context
'and using archived'
do
it
"returns the group's archived projects"
do
get
api
(
"/groups/
#{
group1
.
id
}
/projects?archived=true"
,
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
Project
.
public_or_visible_to_user
(
user1
).
where
(
archived:
true
).
size
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
include
(
archived_project
.
id
)
end
it
"returns the group's non-archived projects"
do
get
api
(
"/groups/
#{
group1
.
id
}
/projects?archived=false"
,
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
Project
.
public_or_visible_to_user
(
user1
).
where
(
archived:
false
).
size
)
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
not_to
include
(
archived_project
.
id
)
end
it
"returns all of the group's projects"
do
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user1
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
project
|
project
[
'id'
]
}).
to
contain_exactly
(
*
Project
.
public_or_visible_to_user
(
user1
).
pluck
(
:id
))
end
end
it
"returns the group's projects with simple representation"
do
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user1
),
params:
{
simple:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
length
).
to
eq
(
3
)
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
,
archived_project
.
name
])
expect
(
json_response
.
first
[
'visibility'
]).
not_to
be_present
end
...
...
@@ -861,7 +893,7 @@ def make_upload_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
length
).
to
eq
(
3
)
end
it
"returns projects including those in subgroups"
do
...
...
@@ -874,7 +906,7 @@ def make_upload_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
length
).
to
eq
(
4
)
expect
(
json_response
.
length
).
to
eq
(
5
)
end
it
"does not return a non existing group"
do
...
...
@@ -959,7 +991,7 @@ def make_upload_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
,
archived_project
.
name
])
end
it
'does not return a non existing group'
do
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录