PromptWar / tests /conftest.py
Mr-TD's picture
feat: Add operator dashboard, alerts, analytics, and simulator pages
aefe381
"""Test configuration and fixtures."""
import pytest
import sys
import os
# Add project root to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app import create_app
from config import TestingConfig
@pytest.fixture
def app():
"""Create application for testing."""
app = create_app(TestingConfig)
app.config["TESTING"] = True
app.config["WTF_CSRF_ENABLED"] = False
yield app
@pytest.fixture
def client(app):
"""Test client fixture."""
return app.test_client()
@pytest.fixture
def auth_client(client):
"""Authenticated test client (as attendee)."""
with client.session_transaction() as sess:
sess["user_id"] = "fan1"
sess["user_email"] = "fan@venueflow.demo"
sess["user_name"] = "Demo Fan"
sess["user_role"] = "attendee"
return client
@pytest.fixture
def operator_client(client):
"""Authenticated test client (as operator)."""
with client.session_transaction() as sess:
sess["user_id"] = "op1"
sess["user_email"] = "operator@venueflow.demo"
sess["user_name"] = "Demo Operator"
sess["user_role"] = "operator"
return client