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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
e9c3c3bf
Commit
e9c3c3bf
authored
Feb 08, 2019
by
Balasankar "Balu" C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for commit's GPG signature API endpoint
parent
034d1d02
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+38
-0
No files found.
spec/requests/api/commits_spec.rb
View file @
e9c3c3bf
...
@@ -1457,4 +1457,42 @@ describe API::Commits do
...
@@ -1457,4 +1457,42 @@ describe API::Commits do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
end
describe
'GET /projects/:id/repository/commits/:sha/signature'
do
let!
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
let
(
:project_id
)
{
project
.
id
}
let
(
:commit_id
)
{
project
.
repository
.
commit
.
id
}
let
(
:route
)
{
"/projects/
#{
project_id
}
/repository/commits/
#{
commit_id
}
/signature"
}
context
'when commit does not exist'
do
let
(
:commit_id
)
{
'unknown'
}
it_behaves_like
'404 response'
do
let
(
:request
)
{
get
api
(
route
,
current_user
)
}
let
(
:message
)
{
'404 Commit Not Found'
}
end
end
context
'unsigned commit'
do
it_behaves_like
'404 response'
do
let
(
:request
)
{
get
api
(
route
,
current_user
)
}
let
(
:message
)
{
'404 GPG Signature Not Found'
}
end
end
context
'signed commit'
do
let
(
:commit
)
{
project
.
repository
.
commit
(
GpgHelpers
::
SIGNED_COMMIT_SHA
)
}
let
(
:commit_id
)
{
commit
.
id
}
it
'returns correct JSON'
do
get
api
(
route
,
current_user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'gpg_key_id'
]).
to
eq
(
commit
.
signature
.
gpg_key_id
)
expect
(
json_response
[
'gpg_key_subkey_id'
]).
to
eq
(
commit
.
signature
.
gpg_key_subkey_id
)
expect
(
json_response
[
'gpg_key_primary_keyid'
]).
to
eq
(
commit
.
signature
.
gpg_key_primary_keyid
)
expect
(
json_response
[
'verification_status'
]).
to
eq
(
commit
.
signature
.
verification_status
)
end
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