Skip to content

fix(tests): load SECRET_KEY from .env for internal API tests (#754) - #757

Merged
vybe merged 1 commit into
devfrom
feature/754-internal-secret-test-env
May 10, 2026
Merged

vybe merged 1 commit into
devfrom
feature/754-internal-secret-test-env

Conversation

@vybe

@vybe vybe commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • conftest.py early-init block now loads SECRET_KEY and INTERNAL_API_SECRET from the project .env via dotenv_values (which resolves duplicate keys by returning the last value)
  • Uses setdefault so explicitly-exported env vars always take precedence
  • Fixes 5 tests in test_internal.py that were skipping (or failing 403) because the X-Internal-Secret header couldn't be populated without manually exporting the secret before running tests

Changes

  • tests/conftest.py — 20-line addition in the early-init block, same pattern as the existing Redis env-var setup

Test Plan

  • pytest tests/test_internal.py -v → 7 passed, 0 failed (was 7 skipped / 5 failed)
  • No regressions in broader test collection

Fixes #754

🤖 Generated with Claude Code

conftest.py early-init block now reads SECRET_KEY and INTERNAL_API_SECRET
from the project .env file via dotenv_values (handles duplicate keys,
uses last value). Uses setdefault so explicitly-exported env vars win.

Fixes 5 tests in test_internal.py that were skipping (or failing with
403 when env vars were set but wrong) because the X-Internal-Secret
header couldn't be populated without manual env var export.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@vybe
vybe merged commit 6732ba3 into dev May 10, 2026
7 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.

1 participant