tests: cover login and credential-storage edge branches - #5
Merged
josephrich98 merged 1 commit intoSep 18, 2026
Merged
Conversation
Cover the lowest-coverage paths in paperpush/venues/login.py and paperpush/credentials.py: verify_login driver behavior (headless/headed, ORCID, human fallback), the login_form helpers, and the many keyring / file-store branches of save_credential / get_credential / _get_keyring.
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.
Summary
Adds unit tests for the two lowest-coverage files in the codebase,
paperpush/venues/login.py(+32 tests, 52% → 94%) andpaperpush/credentials.py(69% → 98%), using the existing fake-playwright test infrastructure (_FakePage/_FakeLocator). No production code changes; a venv-free, hermetic test-only PR.What's covered
verify_logindriver (tests/test_login.py)headless=is passed through to the venue'slogin.method="orcid") passesorcid=Truedown; refused when the venue lackssupports_orcid_login(sameorcid_unsupportedmessage the submission path produces).LoginVerificationErrornaming the venue.LoginVerificationErrorwith the underlying cause; headed failure → prompt for a human, re-check, then save only if logged in.LoginVerificationError("...did not take...").NotImplementedErrorfrom the venue propagates unchanged.paperpush/credentials.py(keyring + file store)save_credential: writes to keyring with service namepaperpush:<slug>; falls back to the file store when the keyring rejects a write or a read.get_credential/delete_credential: clear keyring + file store; incomplete keyring entry / corrupt file store treated as absent/empty._get_keyringbranch coverage: keyring module missing (ImportError), backend lookup failure, failing backend, working backend.paperpush/venues/login.pyhelpersfirst_present/first_visiblefast/slow paths.fill_login_form(shared by the login page): success and missing-controlVenueLoginError.login_orcid: popup control absent and ORCID form field missing → clean popup close.Validation
pytest: 1382 passed / 74 skipped (was 1350); all portal tests still skipped by default; zero network or OS-keyring access (fixtures are additive only).black . -l 99999 --check: clean.gen_readme_venues.py,gen_venues_schema.py,gen_schema_docs.py,gen_subfile_templates.py) — no generated files touched.