Improve shared examples for api admin mode with failed status code
requested to merge gitlab-community/gitlab:change/shared_example_api_admin_mode_status_code into master
What does this MR do and why?
Further improvements for the shared examples for the api admin mode concerning failed_status_code
. A test was adapted accordingly to test the function.
Basicly: It should be possible to change the failed status code, e.g. instead to check for status :forbidden
it should check for e.g. :not_found
How to:
it_behaves_like 'GET request permissions for admin mode', :not_found
This results in (for a regular user)
admin mode | http method | outcome (status) |
---|---|---|
true | GET | :not_found |
false | GET | :not_found |
This results in (for an admin)
admin mode | http method | outcome (status) |
---|---|---|
true | GET | :ok |
false | GET | :not_found |
Context: issue
How should the shared examples behave: #42692 (comment 1299073958)
How to set up and validate locally
Either adjust any test from spec/spec_helper.rb
using the shared examples OR run spec/requests/api/freeze_periods_spec.rb
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Andreas Deicha