Introduced groups and added all related endpoints
All checks were successful
AWS Deploy on Push / build (push) Successful in 7m39s
All checks were successful
AWS Deploy on Push / build (push) Successful in 7m39s
This commit is contained in:
@@ -173,3 +173,33 @@ def test_mock_auth_import(monkeypatch):
|
||||
|
||||
# Reload again to restore original state
|
||||
importlib.reload(app.auth.dependencies)
|
||||
|
||||
|
||||
def test_cognito_auth_import(monkeypatch):
|
||||
"""Test that cognito auth is imported when MOCK_AUTH=false (covers line 14)"""
|
||||
# Save original env var value
|
||||
original_value = os.environ.get("MOCK_AUTH")
|
||||
|
||||
try:
|
||||
# Set MOCK_AUTH to false
|
||||
monkeypatch.setenv("MOCK_AUTH", "false")
|
||||
|
||||
# Reload the dependencies module to trigger the import condition
|
||||
import app.auth.dependencies
|
||||
|
||||
importlib.reload(app.auth.dependencies)
|
||||
|
||||
# Verify that get_user_from_token was imported from app.auth.cognito
|
||||
from app.auth.dependencies import get_user_from_token
|
||||
|
||||
assert get_user_from_token.__module__ == "app.auth.cognito"
|
||||
|
||||
finally:
|
||||
# Restore original env var
|
||||
if original_value is None:
|
||||
monkeypatch.delenv("MOCK_AUTH", raising=False)
|
||||
else:
|
||||
monkeypatch.setenv("MOCK_AUTH", original_value)
|
||||
|
||||
# Reload again to restore original state
|
||||
importlib.reload(app.auth.dependencies)
|
||||
|
||||
Reference in New Issue
Block a user