""" Pytest configuration and fixtures. """ import pytest import sys import os # Add the backend directory to the path sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @pytest.fixture(autouse=True) def mock_env(monkeypatch): """Set up mock environment variables for all tests.""" monkeypatch.setenv("DB_HOST", "localhost") monkeypatch.setenv("DB_PORT", "3306") monkeypatch.setenv("DB_USER", "test") monkeypatch.setenv("DB_PASS", "test") monkeypatch.setenv("DB_NAME", "test_db") monkeypatch.setenv("AUTH_API_URL", "https://auth.test.com/login") monkeypatch.setenv("DIFY_API_URL", "https://dify.test.com/v1") monkeypatch.setenv("DIFY_API_KEY", "test-api-key") monkeypatch.setenv("ADMIN_EMAIL", "admin@test.com") monkeypatch.setenv("JWT_SECRET", "test-jwt-secret") @pytest.fixture def sample_meeting(): """Sample meeting data for tests.""" return { "subject": "Test Meeting", "meeting_time": "2025-01-15T10:00:00", "location": "Conference Room A", "chairperson": "John Doe", "recorder": "Jane Smith", "attendees": "alice@test.com, bob@test.com", } @pytest.fixture def sample_transcript(): """Sample transcript for AI tests.""" return """ 今天的會議主要討論了Q1預算和新員工招聘計劃。 決定將行銷預算增加10%。 小明負責在下週五前提交最終報告。 """