"""Pytest fixtures for Daily Briefing MCP tests."""
import os
from datetime import date, datetime, timedelta
from zoneinfo import ZoneInfo
import pytest
# Set test environment variables before importing modules
os.environ["BRIEFING_LOG_LEVEL"] = "DEBUG"
os.environ["BRIEFING_TIMEZONE"] = "America/New_York"
@pytest.fixture
def tz():
"""Get the configured timezone."""
return ZoneInfo("America/New_York")
@pytest.fixture
def today():
"""Get today's date."""
return date.today()
@pytest.fixture
def sample_ical_data(today, tz):
"""Generate sample iCal data for testing."""
tomorrow = today + timedelta(days=1)
# Create events for today
event_start = datetime.combine(today, datetime.min.time().replace(hour=10)).replace(tzinfo=tz)
event_end = datetime.combine(today, datetime.min.time().replace(hour=11)).replace(tzinfo=tz)
event2_start = datetime.combine(today, datetime.min.time().replace(hour=14)).replace(tzinfo=tz)
event2_end = datetime.combine(today, datetime.min.time().replace(hour=15)).replace(tzinfo=tz)
return f"""BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Test//Test//EN
BEGIN:VEVENT
UID:test-event-1@example.com
DTSTART:{event_start.strftime("%Y%m%dT%H%M%S")}
DTEND:{event_end.strftime("%Y%m%dT%H%M%S")}
SUMMARY:Team Standup
LOCATION:Conference Room A
END:VEVENT
BEGIN:VEVENT
UID:test-event-2@example.com
DTSTART:{event2_start.strftime("%Y%m%dT%H%M%S")}
DTEND:{event2_end.strftime("%Y%m%dT%H%M%S")}
SUMMARY:Product Review
END:VEVENT
END:VCALENDAR"""
@pytest.fixture
def sample_travel_ical_data(today, tz):
"""Generate sample travel iCal data for testing."""
trip_start = today + timedelta(days=3)
trip_end = today + timedelta(days=5)
flight_start = datetime.combine(trip_start, datetime.min.time().replace(hour=8)).replace(tzinfo=tz)
flight_end = datetime.combine(trip_start, datetime.min.time().replace(hour=11)).replace(tzinfo=tz)
return f"""BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//TripIt//Test//EN
BEGIN:VEVENT
UID:flight-1@tripit.com
DTSTART:{flight_start.strftime("%Y%m%dT%H%M%S")}
DTEND:{flight_end.strftime("%Y%m%dT%H%M%S")}
SUMMARY:Flight to San Francisco - UA123
LOCATION:SFO
END:VEVENT
END:VCALENDAR"""
@pytest.fixture
def sample_fireflies_response():
"""Sample Fireflies API response."""
return {
"data": {
"transcripts": [
{
"id": "meeting-123",
"title": "Sprint Planning",
"date": (datetime.now() - timedelta(days=1)).isoformat() + "Z",
"duration": 3600,
"participants": ["alice@example.com", "bob@example.com"],
"summary": {
"overview": "Team discussed upcoming sprint priorities and assigned tasks.",
"action_items": [
"Alice to review PR #456",
"Bob to update documentation",
"Schedule follow-up meeting for Friday",
],
"topics_discussed": ["Sprint priorities", "Technical debt", "Release timeline"],
},
}
]
}
}