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
06638bf5
Commit
06638bf5
authored
Feb 21, 2022
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix docs, add license check for update
parent
cfcd67b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
10 deletions
+30
-10
doc/api/alert_management_alerts.md
doc/api/alert_management_alerts.md
+0
-1
ee/lib/api/alert_management_alerts.rb
ee/lib/api/alert_management_alerts.rb
+2
-0
ee/spec/requests/api/alert_management_alerts_spec.rb
ee/spec/requests/api/alert_management_alerts_spec.rb
+28
-9
No files found.
doc/api/alert_management_alerts.md
View file @
06638bf5
...
...
@@ -40,7 +40,6 @@ Example response:
}
```
## List metric images
```
plaintext
...
...
ee/lib/api/alert_management_alerts.rb
View file @
06638bf5
...
...
@@ -80,6 +80,8 @@ module API
authorize!
(
:update_alert_management_metric_image
,
alert
)
render_api_error!
(
'Not allowed!'
,
400
)
unless
alert
.
metric_images_available?
metric_image
=
alert
.
metric_images
.
find_by_id
(
params
[
:metric_image_id
])
render_api_error!
(
'Metric image not found'
,
404
)
unless
metric_image
...
...
ee/spec/requests/api/alert_management_alerts_spec.rb
View file @
06638bf5
...
...
@@ -299,25 +299,44 @@ RSpec.describe API::AlertManagementAlerts do
project
.
add_developer
(
user
)
end
context
'metric image not found'
do
subject
{
put
api
(
"/projects/
#{
project
.
id
}
/alert_management_alerts/
#{
alert
.
iid
}
/metric_images/
#{
non_existing_record_id
}
"
,
user
)
}
context
'feature is enabled'
do
before
do
stub_licensed_features
(
alert_metric_upload:
true
)
end
it
'returns an error'
do
subject
context
'metric image not found'
do
subject
{
put
api
(
"/projects/
#{
project
.
id
}
/alert_management_alerts/
#{
alert
.
iid
}
/metric_images/
#{
non_existing_record_id
}
"
,
user
)
}
it
'returns an error'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Metric image not found'
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Metric image not found'
)
end
end
context
'metric image cannot be updated'
do
let
(
:params
)
{
{
url_text:
'something_long'
*
100
}
}
it
'returns an error'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Metric image could not be updated'
)
end
end
end
context
'metric image cannot be updated'
do
let
(
:params
)
{
{
url_text:
'something_long'
*
100
}
}
context
'feature not enabled'
do
before
do
stub_licensed_features
(
alert_metric_upload:
false
)
end
it
'returns an error'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
eq
(
'
Metric image could not be updated
'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'
Not allowed!
'
)
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