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
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user