Skip to content

Add comprehensive tests for IA S3 authentication and loan logic#185

Merged
ronibhakta1 merged 4 commits into
ArchiveLabs:mainfrom
ronibhakta1:feature/Oauth-switch
Jun 10, 2026
Merged

Add comprehensive tests for IA S3 authentication and loan logic#185
ronibhakta1 merged 4 commits into
ArchiveLabs:mainfrom
ronibhakta1:feature/Oauth-switch

Conversation

@ronibhakta1

@ronibhakta1 ronibhakta1 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #183 #184
This pull request introduces several significant improvements to authentication, configuration, and development workflows for the Lenny project. The main changes include support for external OAuth/OIDC and IA S3 patron authentication, a refactor of environment variable management into dedicated files, and enhanced documentation for local development. Additionally, the PR adds a database migration for loan due dates and pins frontend dependencies to specific commits for reproducibility.

Authentication Enhancements:

  • Added support for external OAuth/OIDC providers for patron authentication, configurable via auth.env and the Admin UI. IA S3 patron authentication is now also supported and toggled independently. [1] [2] [3] [4]

Environment Configuration Refactor:

  • Split environment variables into .env (core), auth.env (admin credentials and OAuth), ol.env (Open Library/IA credentials), and loan.env (loan policy). Updated Docker and utility scripts to use these files, improving security and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Local Development Improvements:

  • Added detailed documentation for running the lenny-app admin UI locally, including required compose.yaml changes and .env.local setup. [1] [2]

Database and Versioning:

  • Introduced a new Alembic migration to add an optional due_date field to the loans table, supporting future loan expiration features.
  • Bumped the project version to 0.2.3.

Frontend Dependency Management:

  • Pinned both lenny-app and thorium-web Docker builds to specific commit SHAs, ensuring deterministic builds and easier upgrades. [1] [2]

These changes collectively improve authentication flexibility, deployment security, and developer experience.

  • Implement tests for the validate_patron_ia_s3 function, covering various scenarios including successful validation, email normalization, error handling for unauthorized access, and fallback mechanisms.
  • Create tests for the /oauth/ia-s3 route to ensure proper behavior when authentication is enabled or disabled, including session cookie handling and error responses.
  • Introduce tests for loan settings, including configuration overrides, due date calculations, and error handling for borrowing limits and unavailable books.
  • Ensure that all tests utilize mocking to isolate functionality and avoid dependencies on external systems.

- Implement tests for the `validate_patron_ia_s3` function, covering various scenarios including successful validation, email normalization, error handling for unauthorized access, and fallback mechanisms.
- Create tests for the `/oauth/ia-s3` route to ensure proper behavior when authentication is enabled or disabled, including session cookie handling and error responses.
- Introduce tests for loan settings, including configuration overrides, due date calculations, and error handling for borrowing limits and unavailable books.
- Ensure that all tests utilize mocking to isolate functionality and avoid dependencies on external systems.
@ronibhakta1 ronibhakta1 merged commit 56295b9 into ArchiveLabs:main Jun 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(auth): Optional IA auth plugin — allow patron borrow via IA S3 credentials

1 participant