Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fb3ae25c
Commit
fb3ae25c
authored
Mar 23, 2020
by
Michael Leopard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposing created_at property in Groups API
Updating Groups API unit tests and documentation
parent
ac0e46d0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
changelogs/unreleased/expose-created-at-in-groups-api.yml
changelogs/unreleased/expose-created-at-in-groups-api.yml
+5
-0
doc/api/groups.md
doc/api/groups.md
+7
-2
lib/api/entities/group.rb
lib/api/entities/group.rb
+1
-0
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+22
-0
No files found.
changelogs/unreleased/expose-created-at-in-groups-api.yml
0 → 100644
View file @
fb3ae25c
---
title
:
Expose created_at property in Groups API
merge_request
:
27824
author
:
type
:
added
doc/api/groups.md
View file @
fb3ae25c
...
@@ -49,7 +49,8 @@ GET /groups
...
@@ -49,7 +49,8 @@ GET /groups
"full_name"
:
"Foobar Group"
,
"full_name"
:
"Foobar Group"
,
"full_path"
:
"foo-bar"
,
"full_path"
:
"foo-bar"
,
"file_template_project_id"
:
1
,
"file_template_project_id"
:
1
,
"parent_id"
:
null
"parent_id"
:
null
,
"created_at"
:
"2020-01-15T12:36:29.590Z"
}
}
]
]
```
```
...
@@ -85,6 +86,7 @@ GET /groups?statistics=true
...
@@ -85,6 +86,7 @@ GET /groups?statistics=true
"full_path"
:
"foo-bar"
,
"full_path"
:
"foo-bar"
,
"file_template_project_id"
:
1
,
"file_template_project_id"
:
1
,
"parent_id"
:
null
,
"parent_id"
:
null
,
"created_at"
:
"2020-01-15T12:36:29.590Z"
,
"statistics"
:
{
"statistics"
:
{
"storage_size"
:
212
,
"storage_size"
:
212
,
"repository_size"
:
33
,
"repository_size"
:
33
,
...
@@ -157,7 +159,8 @@ GET /groups/:id/subgroups
...
@@ -157,7 +159,8 @@ GET /groups/:id/subgroups
"full_name"
:
"Foobar Group"
,
"full_name"
:
"Foobar Group"
,
"full_path"
:
"foo-bar"
,
"full_path"
:
"foo-bar"
,
"file_template_project_id"
:
1
,
"file_template_project_id"
:
1
,
"parent_id"
:
123
"parent_id"
:
123
,
"created_at"
:
"2020-01-15T12:36:29.590Z"
}
}
]
]
```
```
...
@@ -282,6 +285,7 @@ Example response:
...
@@ -282,6 +285,7 @@ Example response:
"runners_token"
:
"ba324ca7b1c77fc20bb9"
,
"runners_token"
:
"ba324ca7b1c77fc20bb9"
,
"file_template_project_id"
:
1
,
"file_template_project_id"
:
1
,
"parent_id"
:
null
,
"parent_id"
:
null
,
"created_at"
:
"2020-01-15T12:36:29.590Z"
,
"projects"
:
[
"projects"
:
[
{
{
"id"
:
7
,
"id"
:
7
,
...
@@ -591,6 +595,7 @@ Example response:
...
@@ -591,6 +595,7 @@ Example response:
"full_path"
:
"foo-bar"
,
"full_path"
:
"foo-bar"
,
"file_template_project_id"
:
1
,
"file_template_project_id"
:
1
,
"parent_id"
:
null
,
"parent_id"
:
null
,
"created_at"
:
"2020-01-15T12:36:29.590Z"
,
"projects"
:
[
"projects"
:
[
{
{
"id"
:
9
,
"id"
:
9
,
...
...
lib/api/entities/group.rb
View file @
fb3ae25c
...
@@ -19,6 +19,7 @@ module API
...
@@ -19,6 +19,7 @@ module API
end
end
expose
:request_access_enabled
expose
:request_access_enabled
expose
:full_name
,
:full_path
expose
:full_name
,
:full_path
expose
:created_at
expose
:parent_id
expose
:parent_id
expose
:custom_attributes
,
using:
'API::Entities::CustomAttribute'
,
if: :with_custom_attributes
expose
:custom_attributes
,
using:
'API::Entities::CustomAttribute'
,
if: :with_custom_attributes
...
...
spec/requests/api/groups_spec.rb
View file @
fb3ae25c
...
@@ -71,6 +71,7 @@ describe API::Groups do
...
@@ -71,6 +71,7 @@ describe API::Groups do
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'created_at'
]).
to
be_present
expect
(
json_response
)
expect
(
json_response
)
.
to
satisfy_one
{
|
group
|
group
[
'name'
]
==
group1
.
name
}
.
to
satisfy_one
{
|
group
|
group
[
'name'
]
==
group1
.
name
}
end
end
...
@@ -121,6 +122,15 @@ describe API::Groups do
...
@@ -121,6 +122,15 @@ describe API::Groups do
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
).
not_to
include
'statistics'
expect
(
json_response
.
first
).
not_to
include
'statistics'
end
end
it
"includes a created_at timestamp"
do
get
api
(
"/groups"
,
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
.
first
[
'created_at'
]).
to
be_present
end
end
end
context
"when authenticated as admin"
do
context
"when authenticated as admin"
do
...
@@ -152,6 +162,15 @@ describe API::Groups do
...
@@ -152,6 +162,15 @@ describe API::Groups do
expect
(
json_response
.
first
).
not_to
include
(
'statistics'
)
expect
(
json_response
.
first
).
not_to
include
(
'statistics'
)
end
end
it
"includes a created_at timestamp"
do
get
api
(
"/groups"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'created_at'
]).
to
be_present
end
it
"includes statistics if requested"
do
it
"includes statistics if requested"
do
attributes
=
{
attributes
=
{
storage_size:
1158
,
storage_size:
1158
,
...
@@ -357,6 +376,7 @@ describe API::Groups do
...
@@ -357,6 +376,7 @@ describe API::Groups do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
not_to
include
(
'runners_token'
)
expect
(
json_response
).
not_to
include
(
'runners_token'
)
expect
(
json_response
).
to
include
(
'created_at'
)
end
end
it
'returns only public projects in the group'
do
it
'returns only public projects in the group'
do
...
@@ -407,6 +427,7 @@ describe API::Groups do
...
@@ -407,6 +427,7 @@ describe API::Groups do
expect
(
json_response
[
'full_name'
]).
to
eq
(
group1
.
full_name
)
expect
(
json_response
[
'full_name'
]).
to
eq
(
group1
.
full_name
)
expect
(
json_response
[
'full_path'
]).
to
eq
(
group1
.
full_path
)
expect
(
json_response
[
'full_path'
]).
to
eq
(
group1
.
full_path
)
expect
(
json_response
[
'parent_id'
]).
to
eq
(
group1
.
parent_id
)
expect
(
json_response
[
'parent_id'
]).
to
eq
(
group1
.
parent_id
)
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'projects'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
...
@@ -613,6 +634,7 @@ describe API::Groups do
...
@@ -613,6 +634,7 @@ describe API::Groups do
expect
(
json_response
[
'subgroup_creation_level'
]).
to
eq
(
"maintainer"
)
expect
(
json_response
[
'subgroup_creation_level'
]).
to
eq
(
"maintainer"
)
expect
(
json_response
[
'request_access_enabled'
]).
to
eq
(
true
)
expect
(
json_response
[
'request_access_enabled'
]).
to
eq
(
true
)
expect
(
json_response
[
'parent_id'
]).
to
eq
(
nil
)
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'
]).
to
be_an
Array
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'projects'
].
length
).
to
eq
(
2
)
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
expect
(
json_response
[
'shared_projects'
]).
to
be_an
Array
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment