Files
demo-oidc/tests/conftest.py
T
herel 0e3311df8e docs: update README and add test infrastructure
- Enhance .gitignore with comprehensive Python patterns
- Improve README with better setup and testing instructions
- Add test infrastructure:
  * Test requirements file
  * Environment setup script
  * Test runner script
  * Comprehensive test suite
  * Coverage configuration
2025-08-08 10:54:56 +02:00

48 lines
1.2 KiB
Python

import pytest
from fastapi.testclient import TestClient
from main import app
@pytest.fixture(scope="module")
def test_client():
"""Create a test client for the FastAPI app."""
with TestClient(app) as client:
yield client
@pytest.fixture
def mock_valid_token_payload():
"""Mock payload for a valid JWT token."""
return {
"iss": "https://login.infomaniak.com",
"aud": "test-client-id",
"sub": "1234567890",
"email": "rene.luria@infomaniak.com",
"exp": 9999999999,
"iat": 1609459200
}
@pytest.fixture
def mock_invalid_token_payload():
"""Mock payload for an invalid JWT token."""
return {
"iss": "https://invalid.issuer.com",
"aud": "wrong-client-id",
"sub": "1234567890",
"email": "unauthorized@example.com",
"exp": 9999999999,
"iat": 1609459200
}
@pytest.fixture
def mock_jwks():
"""Mock JWKS for token validation."""
return {
"keys": [
{
"kty": "RSA",
"kid": "test-key-id",
"use": "sig",
"n": "test-modulus",
"e": "AQAB"
}
]
}