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
c042ce00
Commit
c042ce00
authored
Apr 30, 2021
by
Dmytro Zaporozhets (DZ)
Committed by
Markus Koller
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec project schema
So we can test a single project schema included in other entities
parent
24cc1eb4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
68 deletions
+48
-68
spec/fixtures/api/schemas/public_api/v4/project.json
spec/fixtures/api/schemas/public_api/v4/project.json
+45
-0
spec/fixtures/api/schemas/public_api/v4/projects.json
spec/fixtures/api/schemas/public_api/v4/projects.json
+1
-45
spec/requests/api/environments_spec.rb
spec/requests/api/environments_spec.rb
+1
-11
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+1
-12
No files found.
spec/fixtures/api/schemas/public_api/v4/project.json
0 → 100644
View file @
c042ce00
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"name_with_namespace"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"path"
:
{
"type"
:
"string"
},
"path_with_namespace"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
},
"default_branch"
:
{
"type"
:
[
"string"
,
"null"
]
},
"tag_list"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"string"
}
},
"ssh_url_to_repo"
:
{
"type"
:
"string"
},
"http_url_to_repo"
:
{
"type"
:
"string"
},
"web_url"
:
{
"type"
:
"string"
},
"readme_url"
:
{
"type"
:
[
"string"
,
"null"
]
},
"avatar_url"
:
{
"type"
:
[
"string"
,
"null"
]
},
"star_count"
:
{
"type"
:
"integer"
},
"forks_count"
:
{
"type"
:
"integer"
},
"last_activity_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
},
"namespace"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"path"
:
{
"type"
:
"string"
},
"kind"
:
{
"type"
:
"string"
},
"full_path"
:
{
"type"
:
"string"
},
"parent_id"
:
{
"type"
:
[
"integer"
,
"null"
]
}
}
}
},
"required"
:
[
"id"
,
"name"
,
"name_with_namespace"
,
"description"
,
"path"
,
"path_with_namespace"
,
"created_at"
,
"default_branch"
,
"tag_list"
,
"ssh_url_to_repo"
,
"http_url_to_repo"
,
"web_url"
,
"readme_url"
,
"avatar_url"
,
"star_count"
,
"forks_count"
,
"last_activity_at"
,
"namespace"
],
"additionalProperties"
:
false
}
spec/fixtures/api/schemas/public_api/v4/projects.json
View file @
c042ce00
{
{
"type"
:
"array"
,
"type"
:
"array"
,
"items"
:
{
"items"
:
{
"$ref"
:
"project.json"
}
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"name_with_namespace"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
[
"string"
,
"null"
]
},
"path"
:
{
"type"
:
"string"
},
"path_with_namespace"
:
{
"type"
:
"string"
},
"created_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
},
"default_branch"
:
{
"type"
:
[
"string"
,
"null"
]
},
"tag_list"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"string"
}
},
"ssh_url_to_repo"
:
{
"type"
:
"string"
},
"http_url_to_repo"
:
{
"type"
:
"string"
},
"web_url"
:
{
"type"
:
"string"
},
"readme_url"
:
{
"type"
:
[
"string"
,
"null"
]
},
"avatar_url"
:
{
"type"
:
[
"string"
,
"null"
]
},
"star_count"
:
{
"type"
:
"integer"
},
"forks_count"
:
{
"type"
:
"integer"
},
"last_activity_at"
:
{
"type"
:
"string"
,
"format"
:
"date-time"
},
"namespace"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
},
"path"
:
{
"type"
:
"string"
},
"kind"
:
{
"type"
:
"string"
},
"full_path"
:
{
"type"
:
"string"
},
"parent_id"
:
{
"type"
:
[
"integer"
,
"null"
]
}
}
}
},
"required"
:
[
"id"
,
"name"
,
"name_with_namespace"
,
"description"
,
"path"
,
"path_with_namespace"
,
"created_at"
,
"default_branch"
,
"tag_list"
,
"ssh_url_to_repo"
,
"http_url_to_repo"
,
"web_url"
,
"avatar_url"
,
"star_count"
,
"last_activity_at"
,
"namespace"
],
"additionalProperties"
:
false
}
}
}
spec/requests/api/environments_spec.rb
View file @
c042ce00
...
@@ -15,16 +15,6 @@ RSpec.describe API::Environments do
...
@@ -15,16 +15,6 @@ RSpec.describe API::Environments do
describe
'GET /projects/:id/environments'
do
describe
'GET /projects/:id/environments'
do
context
'as member of the project'
do
context
'as member of the project'
do
it
'returns project environments'
do
it
'returns project environments'
do
project_data_keys
=
%w(
id description default_branch tag_list
ssh_url_to_repo http_url_to_repo web_url readme_url
name name_with_namespace
path path_with_namespace
star_count forks_count
created_at last_activity_at
avatar_url namespace
)
get
api
(
"/projects/
#{
project
.
id
}
/environments"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/environments"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -33,7 +23,7 @@ RSpec.describe API::Environments do
...
@@ -33,7 +23,7 @@ RSpec.describe API::Environments do
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
environment
.
name
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
environment
.
name
)
expect
(
json_response
.
first
[
'external_url'
]).
to
eq
(
environment
.
external_url
)
expect
(
json_response
.
first
[
'external_url'
]).
to
eq
(
environment
.
external_url
)
expect
(
json_response
.
first
[
'project'
]
.
keys
).
to
contain_exactly
(
*
project_data_keys
)
expect
(
json_response
.
first
[
'project'
]
).
to
match_schema
(
'public_api/v4/project'
)
expect
(
json_response
.
first
[
'enable_advanced_logs_querying'
]).
to
eq
(
false
)
expect
(
json_response
.
first
[
'enable_advanced_logs_querying'
]).
to
eq
(
false
)
expect
(
json_response
.
first
).
not_to
have_key
(
'last_deployment'
)
expect
(
json_response
.
first
).
not_to
have_key
(
'last_deployment'
)
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
c042ce00
...
@@ -348,22 +348,11 @@ RSpec.describe API::Projects do
...
@@ -348,22 +348,11 @@ RSpec.describe API::Projects do
context
'and with simple=true'
do
context
'and with simple=true'
do
it
'returns a simplified version of all the projects'
do
it
'returns a simplified version of all the projects'
do
expected_keys
=
%w(
id description default_branch tag_list
ssh_url_to_repo http_url_to_repo web_url readme_url
name name_with_namespace
path path_with_namespace
star_count forks_count
created_at last_activity_at
avatar_url namespace
)
get
api
(
'/projects?simple=true'
,
user
)
get
api
(
'/projects?simple=true'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response
).
to
match_response_schema
(
'public_api/v4/projects'
)
expect
(
json_response
.
first
.
keys
).
to
match_array
expected_keys
end
end
end
end
...
...
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