- FastAPI backend with JWT authentication - ElGamal, RSA-PSS, ZK-proofs crypto modules - HTML5/JS frontend SPA - MariaDB database with 5 tables - Docker Compose with 3 services (frontend, backend, mariadb) - Comprehensive tests for cryptography - Typst technical report (30+ pages) - Makefile with development commands
43 lines
898 B
Python
43 lines
898 B
Python
"""
|
|
Fichier de configuration pour les tests d'intégration.
|
|
"""
|
|
|
|
import pytest
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
import tempfile
|
|
import os
|
|
|
|
# Créer une BD temporaire pour les tests
|
|
TEST_DB_FILE = tempfile.mktemp(suffix='.db')
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def test_db():
|
|
"""Créer une BD SQLite pour les tests"""
|
|
from src.backend.models import Base
|
|
|
|
# Créer l'engine SQLite
|
|
engine = create_engine(f'sqlite:///{TEST_DB_FILE}')
|
|
Base.metadata.create_all(engine)
|
|
|
|
yield engine
|
|
|
|
# Nettoyer
|
|
os.unlink(TEST_DB_FILE)
|
|
|
|
|
|
@pytest.fixture
|
|
def session(test_db):
|
|
"""Créer une session de test"""
|
|
connection = test_db.connect()
|
|
transaction = connection.begin()
|
|
Session = sessionmaker(bind=connection)
|
|
session = Session()
|
|
|
|
yield session
|
|
|
|
session.close()
|
|
transaction.rollback()
|
|
connection.close()
|