Skip to content

Keep a login in backend/.env out of the backend tests - #296

Merged
mt0rm0 merged 1 commit into
devfrom
272-backend-tests-ignore-local-login
Oct 16, 2026
Merged

mt0rm0 merged 1 commit into
devfrom
272-backend-tests-ignore-local-login

Conversation

@mt0rm0

@mt0rm0 mt0rm0 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Closes #272

The backend test suite read the developer's backend/.env. Once a login is configured there (SENTRA_USERS and SESSION_SECRET, which running the stack locally now needs), the role guards close and two upload tests got 401, on that machine only and never in CI.

tests/conftest.py now sets both to empty in the environment. Environment variables outrank the dotenv file in pydantic-settings, so this wins. Tests about the login pass their own users and secret to Settings directly, which outranks both.

🤖 Generated with Claude Code

With SENTRA_USERS set in a developer's .env the role guards close, and two
upload tests got 401 on that machine only. The test configuration now blanks
SENTRA_USERS and SESSION_SECRET in the environment, which outranks the dotenv
file; tests about the login pass their own values to Settings.
@mt0rm0

mt0rm0 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Other infos

  • Offline suite with a real SENTRA_USERS in the local .env: 627 passed. Before this change, 2 failed with 401.
  • The integration tier ran green earlier today with SENTRA_USERS= set by hand, which is the same override.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ffcb0e92-bcb2-4a22-b2c0-f6a1886b3802

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mt0rm0
mt0rm0 merged commit 791b3d5 into dev Oct 16, 2026
5 checks passed
@mt0rm0
mt0rm0 deleted the 272-backend-tests-ignore-local-login branch October 16, 2026 14:44
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.

1 participant