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
Léo-Paul Géneau
gitlab-ce
Commits
383138af
Commit
383138af
authored
Jul 05, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add issues spec and user agent details to entities
parent
bb918a2f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
lib/api/entities.rb
lib/api/entities.rb
+6
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+19
-0
No files found.
lib/api/entities.rb
View file @
383138af
...
...
@@ -875,5 +875,11 @@ module API
expose
:dependencies
,
using:
Dependency
end
end
class
UserAgentDetail
<
Grape
::
Entity
expose
:user_agent
expose
:ip_address
expose
:submitted
end
end
end
spec/requests/api/issues_spec.rb
View file @
383138af
...
...
@@ -1462,6 +1462,25 @@ describe API::Issues do
end
end
describe
"GET /projects/:id/issues/:issue_iid/user_agent_detail"
do
let
(
:user_agent_detail
)
{
create
(
:user_agent_detail
,
subject:
issue
)
}
it
'exposes known attributes'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'submitted'
]).
to
be
false
end
it
"returns unautorized for non-admin users"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
user
)
expect
(
response
).
to
have_http_status
(
403
)
end
end
def
expect_paginated_array_response
(
size:
nil
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
...
...
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