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.13.z] Add json response to entity creation error message #1134

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.13.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: 28
Build Status: SUCCESS
PRT Comment: pytest -k test_negative_update_checksum_with_on_demand_policy tests/foreman/api/test_repository.py --external-logging
Test Result : ========= 2 passed, 162 deselected, 194 warnings in 666.94s (0:11:06) ==========

@Gauravtalreja1 Gauravtalreja1 added the AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing label May 20, 2024
@omkarkhatavkar omkarkhatavkar merged commit 505b8c1 into 6.13.z May 30, 2024
15 of 18 checks passed
@omkarkhatavkar omkarkhatavkar deleted the cherry-pick-6.13.z-95b3ce10125cfbc8d9a6d8a8e2b38a5007dd1b16 branch May 30, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Auto_Cherry_Picked GHA has automatically cherrypicked this PR AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants