Don't raise UsernamePasswordMissingError if Authorization header present#185
Don't raise UsernamePasswordMissingError if Authorization header present#185gy-mate wants to merge 5 commits intometaodi:developfrom
Conversation
Also, update the exception message and unit tests.
79f4096 to
2e3ef81
Compare
|
@metaodi Could you please review this PR? Many thanks in advance! :) |
There was a problem hiding this comment.
Pull request overview
This PR adjusts osmapi’s authentication pre-check to allow authenticated requests when a custom requests.Session already provides an Authorization header (e.g., bearer tokens), and updates test expectations for the revised error message (Fixes #183).
Changes:
- Update
OsmApiSession._http_requestto treat anAuthorizationheader as sufficient to avoid raisingUsernamePasswordMissingError. - Revise the
UsernamePasswordMissingErrormessage to mention missing username/password and missingAuthorizationheader. - Update unit tests to assert the new error message.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
osmapi/http.py |
Adjusts the “missing credentials” guard to allow session-provided Authorization headers; updates raised message. |
tests/node_test.py |
Updates expected error message; removes session mocking in one test (now less isolated). |
tests/changeset_test.py |
Updates expected error message in multiple no-auth test cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
That has a 'None' Authorization header instead of a unittest.mock.Mock object. Fixes metaodi#185 (comment).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # tests/changeset_test.py
Also, update the exception message and unit tests.
This eliminates the need for implementing custom auth methods like the one described here: #183 (comment).
Fixes #183.