Use proper REST API route for getting a single bug (fixes #174) - #183
Conversation
…illa#174) This avoids an `IndexError` in Bugzilla._getbug` and ensures that a `BugzillaError` gets raised e.g. if the bug ID does not exist or the client is not authorized.
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #183 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 2195 2195
=========================================
Hits 2195 2195 ☔ View full report in Codecov by Sentry. |
In comparison to the main branch: |
crobinso
left a comment
There was a problem hiding this comment.
Looks good! Just some small suggestions.
Also, would be good to test the actual semantics in test_ro_functional.py. Say bugzilla.redhat.com bzapi.getbug(100000000) raises expected error string
| data = paramdict.copy() | ||
| data["id"] = listify(bug_ids) | ||
| data["alias"] = listify(aliases) | ||
|
|
There was a problem hiding this comment.
Can you add a comment here explaining why we are doing this: basically it's a hack to keep existing getbug() and getbugs() semantics working in the higher level API
|
|
||
| backend.bug_get(_ids, aliases, {}) | ||
|
|
||
| assert backend.assertion_called is True |
There was a problem hiding this comment.
./setup.py pylint throws some errors. I'm open to modernizing the formatting suggestions here or using tools like pre-commit and/or black, but let's keep this clean until then.
tests/test_backend_rest.py:9: [E501] line too long (85 > 79 characters)
tests/test_backend_rest.py:10: [E501] line too long (90 > 79 characters)
tests/test_backend_rest.py:15: [E501] line too long (86 > 79 characters)
running pylint-3
************* Module tests.test_backend_rest
tests/test_backend_rest.py:17:0: W0613: Unused argument 'kwargs' (unused-argument)
tests/test_backend_rest.py:21:4: W0212: Access to a protected member _get of a client class (protected-access)
There was a problem hiding this comment.
Oh! I'm so used to pylint being part of a CI pipeline that I did not check. I have changed the code.
I'm open to modernizing the formatting suggestions
I created a proposal in #185 🙂
This avoids an
IndexErrorin Bugzilla._getbugand ensures that aBugzillaError` gets raised e.g. if the bug ID does not exist or the client is not authorized.closes #174