Commit fb3ae25c authored by Michael Leopard's avatar Michael Leopard

Exposing created_at property in Groups API

Updating Groups API unit tests and documentation
parent ac0e46d0
---
title: Expose created_at property in Groups API
merge_request: 27824
author:
type: added
......@@ -49,7 +49,8 @@ GET /groups
"full_name": "Foobar Group",
"full_path": "foo-bar",
"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
"full_path": "foo-bar",
"file_template_project_id": 1,
"parent_id": null,
"created_at": "2020-01-15T12:36:29.590Z",
"statistics": {
"storage_size" : 212,
"repository_size" : 33,
......@@ -157,7 +159,8 @@ GET /groups/:id/subgroups
"full_name": "Foobar Group",
"full_path": "foo-bar",
"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:
"runners_token": "ba324ca7b1c77fc20bb9",
"file_template_project_id": 1,
"parent_id": null,
"created_at": "2020-01-15T12:36:29.590Z",
"projects": [
{
"id": 7,
......@@ -591,6 +595,7 @@ Example response:
"full_path": "foo-bar",
"file_template_project_id": 1,
"parent_id": null,
"created_at": "2020-01-15T12:36:29.590Z",
"projects": [
{
"id": 9,
......
......@@ -19,6 +19,7 @@ module API
end
expose :request_access_enabled
expose :full_name, :full_path
expose :created_at
expose :parent_id
expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes
......
......@@ -71,6 +71,7 @@ describe API::Groups do
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.length).to eq(1)
expect(json_response.first['created_at']).to be_present
expect(json_response)
.to satisfy_one { |group| group['name'] == group1.name }
end
......@@ -121,6 +122,15 @@ describe API::Groups do
expect(json_response).to be_an Array
expect(json_response.first).not_to include 'statistics'
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
context "when authenticated as admin" do
......@@ -152,6 +162,15 @@ describe API::Groups do
expect(json_response.first).not_to include('statistics')
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
attributes = {
storage_size: 1158,
......@@ -357,6 +376,7 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).not_to include('runners_token')
expect(json_response).to include('created_at')
end
it 'returns only public projects in the group' do
......@@ -407,6 +427,7 @@ describe API::Groups do
expect(json_response['full_name']).to eq(group1.full_name)
expect(json_response['full_path']).to eq(group1.full_path)
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'].length).to eq(2)
expect(json_response['shared_projects']).to be_an Array
......@@ -613,6 +634,7 @@ describe API::Groups do
expect(json_response['subgroup_creation_level']).to eq("maintainer")
expect(json_response['request_access_enabled']).to eq(true)
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['shared_projects']).to be_an Array
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment