Skip to content

[codex] Isolate auth redirect URI test imports#7944

Open
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-auth-redirect-jwt-stub
Open

[codex] Isolate auth redirect URI test imports#7944
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-auth-redirect-jwt-stub

Conversation

@tianmind-studio

Copy link
Copy Markdown
Contributor

Summary

  • Stub optional jwt / jwt.algorithms.RSAAlgorithm import surfaces in test_auth_redirect_uri.py so the auth redirect tests collect in lightweight Windows backend environments.
  • Add a temporary python_multipart stub while importing routers.auth, matching FastAPI's import-time Form route check without requiring the full multipart dependency for this test.
  • Restore the real utils package path and ensure the Redis auth helper names exist when another stub-heavy test leaves lightweight package modules in sys.modules.

Root cause

test_auth_redirect_uri.py exercises redirect URI validation and auth-code binding, but importing routers.auth also imports optional Apple JWT helpers and builds FastAPI Form endpoints. In this Windows lightweight backend venv, standalone collection failed before any assertions ran:

ModuleNotFoundError: No module named 'jwt'

After the JWT stub, FastAPI's route construction also required python-multipart. Running after test_action_item_date_validation.py exposed a separate order dependency where that test leaves utils / database.redis_db stubs that do not satisfy routers.auth imports.

Validation

  • python -m pytest backend/tests/unit/test_auth_redirect_uri.py --collect-only -q --tb=short -> 46 tests collected
  • python -m pytest backend/tests/unit/test_auth_redirect_uri.py -q --tb=short -> 43 passed, 3 skipped
  • python -m pytest backend/tests/unit/test_action_item_date_validation.py backend/tests/unit/test_auth_redirect_uri.py -q --tb=short -> 69 passed, 3 skipped
  • python -m pytest backend/tests/unit/test_auth_redirect_uri.py backend/tests/unit/test_action_item_date_validation.py -q --tb=short -> 69 passed, 3 skipped
  • black --line-length 120 --skip-string-normalization backend/tests/unit/test_auth_redirect_uri.py
  • python -m py_compile backend/tests/unit/test_auth_redirect_uri.py
  • git diff --check
  • scripts/pre-commit

Stub optional JWT and multipart import surfaces so auth redirect URI tests collect in lightweight Windows backend environments.

Restore the real utils package path and fill required Redis auth helpers when earlier tests leave lightweight package stubs in sys.modules.
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