Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.12.z] Add json response to entity creation error message #1136

Conversation

Satellite-QE
Copy link
Contributor

Cherrypick of PR: #1119

Description of changes

Add json response to entity creation error message

  • Makes the error message information more detailed and informative
  • Possibility to write more precise assertions

There are some robottelo tests that would greatly benefit from more precise assertions on error messages, i.e.
tests/foreman/api/test_repository.py::TestRepository::test_negative_update_checksum_with_on_demand_policy (or other tests in this module)
I doubt that the supposed error message should be:

RuntimeError: The repository's publication is missing. Please run a 'complete sync' on MPvytWJ.","errors":["Task c7fa616b-2f71-4476-b581-1cae65a9eafd: RuntimeError: The repository's publication is missing. Please run a 'complete sync' on MPvytWJ."]}
Upstream API documentation, plugin, or feature links

None

Functional demonstration

Example:

before:

requests.exceptions.HTTPError: ('422 Client Error: Unprocessable Content for url: https://robottelo...')

after

requests.exceptions.HTTPError: ('422 Client Error: Unprocessable Content for url: https://...', {'displayMessage': 'Validation failed: When "Upstream URL" is set, "Releases/Distributions" must also be set!', 'errors': {'base': ['When "Upstream URL" is set, "Releases/Distributions" must also be set!']}}
Additional Information

None

* Makes the error message information more detailed and informative
* Possibility to write more precise assertions

Signed-off-by: dosas <[email protected]>
(cherry picked from commit 95b3ce1)
@Satellite-QE Satellite-QE added 6.12.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR No-CherryPick PR doesnt need CherryPick to previous branches labels Apr 17, 2024
@Satellite-QE
Copy link
Contributor Author

trigger: test-robottelo
pytest: -k test_negative_update_checksum_with_on_demand_policy tests/foreman/api/test_repository.py

@Satellite-QE
Copy link
Contributor Author

PRT Result

Build Number: 27
Build Status: UNSTABLE
PRT Comment: pytest -k test_negative_update_checksum_with_on_demand_policy tests/foreman/api/test_repository.py --external-logging
Test Result : ==== 1 failed, 1 passed, 167 deselected, 205 warnings in 799.79s (0:13:19) =====

@Gauravtalreja1 Gauravtalreja1 merged commit f18f290 into 6.12.z May 30, 2024
14 of 15 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the cherry-pick-6.12.z-95b3ce10125cfbc8d9a6d8a8e2b38a5007dd1b16 branch May 30, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR No-CherryPick PR doesnt need CherryPick to previous branches PRT-Failed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants