SCL: replace assert statements with exceptions, add tests#184
Open
JamieMagee wants to merge 3 commits intotronikos:mainfrom
Open
SCL: replace assert statements with exceptions, add tests#184JamieMagee wants to merge 3 commits intotronikos:mainfrom
JamieMagee wants to merge 3 commits intotronikos:mainfrom
Conversation
SCL's async_login used 10 bare assert statements for runtime validation. These break silently under python -O. Replaced with InvalidAuth exceptions with descriptive messages. Added test coverage: helper function unit tests, HTML fixture parsing for each SSO step, and a gated live login test.
for more information, see https://pre-commit.ci
Owner
|
Can you make pre-commit happy? |
Author
|
@tronikos Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SCL's
async_loginused 10 bareassertstatements for runtime validation. These are silently skipped when Python runs with-O, which means the entire auth flow loses its guardrails in optimized environments.This replaces each assert with an explicit
InvalidAuthraise and a message that says what went wrong:Also adds 14 unit tests (SCL previously had zero). The tests cover:
name(),subdomain(),timezone()_get_session_storage_values()parsing (normal, empty, multiple items)_get_user_token_from_url()extraction (valid, invalid, empty, UUID-style)SCL_USERNAME/SCL_PASSWORDare in.env.secret)No behavioral changes to the happy path. All 54 existing tests still pass.