Handle realWorldEvidence
in login response payload
#54
+116
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements and new features to the
pylibrelinkup
library, particularly focusing on thelogin
model and its associated test cases. The most important changes include adding new models, introducing a field validator, and expanding the test coverage.Enhancements to Models and Validation:
src/pylibrelinkup/models/login.py
: Added new classesHistoryItem
andRealWorldEvidence
to handle additional consent data. Updated theConsents
class to include a newrealWorldEvidence
field.src/pylibrelinkup/models/login.py
: Introduced afield_validator
for theinvitations
field in theData
class to coerce null values to an empty list.Error Handling:
src/pylibrelinkup/pylibrelinkup.py
: Improved error handling in theauthenticate
method by re-raisingValidationError
before raisingAuthenticationError
.Test Coverage:
tests/data/realworldevidence_consent_response.json
: Added a new JSON file to simulate a login response requiring real-world evidence consent.tests/test_client_authentication.py
: Added a new testtest_realworldevidence_consent_in_login_response
to verify the handling of login responses that include real-world evidence consent requirements.Fixes #53