| """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 | |
| def app(): | |
| """Create application for testing.""" | |
| app = create_app(TestingConfig) | |
| app.config["TESTING"] = True | |
| app.config["WTF_CSRF_ENABLED"] = False | |
| yield app | |
| def client(app): | |
| """Test client fixture.""" | |
| return app.test_client() | |
| 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 | |
| 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 | |