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
2a669011
Commit
2a669011
authored
Jan 08, 2020
by
raju249
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate review feedback
parent
c9ed33fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
doc/api/sentry_project_settings.md
doc/api/sentry_project_settings.md
+1
-1
lib/api/error_tracking.rb
lib/api/error_tracking.rb
+5
-2
spec/requests/api/error_tracking_spec.rb
spec/requests/api/error_tracking_spec.rb
+16
-3
No files found.
doc/api/sentry_project_settings.md
View file @
2a669011
...
...
@@ -2,7 +2,7 @@
## Sentry Error Tracking Project Settings
The Sentry Project Settings API allows you to retrieve Sentry Error Tracking Settings for a Project.
The Sentry Project Settings API allows you to retrieve Sentry Error Tracking Settings for a Project.
Only for project maintainers.
### Retrieve Sentry Error Tracking Settings
...
...
lib/api/error_tracking.rb
View file @
2a669011
...
...
@@ -16,8 +16,11 @@ module API
get
':id/error_tracking/sentry_project_settings'
do
authorize!
:read_sentry_issue
,
user_project
sentry_project_settings
=
user_project
.
error_tracking_setting
present
sentry_project_settings
,
with:
Entities
::
SentryProjectErrorTrackingSettings
setting
=
user_project
.
error_tracking_setting
not_found!
(
'Error Tracking Setting'
)
unless
setting
present
setting
,
with:
Entities
::
SentryProjectErrorTrackingSettings
end
end
end
...
...
spec/requests/api/error_tracking_spec.rb
View file @
2a669011
...
...
@@ -4,17 +4,31 @@ require 'spec_helper'
describe
API
::
ErrorTracking
do
describe
"GET sentry project settings"
do
let
(
:project_not_found_message
)
{
"404 Project Not Found"
}
let
(
:unauthorized_message
)
{
"401 Unauthorized"
}
let
(
:settings_not_found_message
)
{
"404 Error Tracking Setting Not Found"
}
let
(
:random_user
)
{
create
(
:user
)
}
let
(
:project_error_tracking_setting
)
{
create
(
:project_error_tracking_setting
)
}
let
(
:project
)
do
create
(
:project
,
:repository
)
end
let
(
:project_with_settings
)
do
create
(
:project
,
:repository
,
error_tracking_setting:
project_error_tracking_setting
)
end
context
'when project has no settings'
do
it
'returns 404'
do
get
api
(
"/projects/
#{
project
.
id
}
/error_tracking/sentry_project_settings"
,
project
.
creator
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
json_response
[
"message"
]).
to
eq
(
settings_not_found_message
)
end
end
context
'when user has permission to view settings'
do
it
'returns 200'
do
get
api
(
"/projects/
#{
project
.
id
}
/error_tracking/sentry_project_settings"
,
project
.
creator
)
get
api
(
"/projects/
#{
project
_with_settings
.
id
}
/error_tracking/sentry_project_settings"
,
project_with_settings
.
creator
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
"project_name"
]).
to
eq
(
project_error_tracking_setting
.
project_name
)
...
...
@@ -26,7 +40,6 @@ describe API::ErrorTracking do
it
'returns 404'
do
get
api
(
"/projects/
#{
project
.
id
}
/error_tracking/sentry_project_settings"
,
random_user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
json_response
[
"message"
]).
to
eq
(
project_not_found_message
)
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