Download tests/test_integration.py from alaa3/TouRa: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/spaces/alaa3/TouRa/resolve/main/tests/test_integration.py
- Command line
-
hf download hf://spaces/alaa3/TouRa/tests/test_integration.py
-
curl -L -o test_integration.py https://huggingface.co/spaces/alaa3/TouRa/resolve/main/tests/test_integration.py
1.98 kB
| """ | |
| Integration tests that exercise the service layer end-to-end (with mocked LLMs). | |
| """ | |
| import pytest | |
| from unittest.mock import patch, MagicMock | |
| from app.core.schemas import TripRequest | |
| def test_run_full_crew( | |
| mock_crew_cls, | |
| mock_fmt_task, | |
| mock_plan_task, | |
| mock_ev_task, | |
| mock_fmt_agent, | |
| mock_plan_agent, | |
| mock_ev_agent, | |
| ): | |
| from app.services.inference import run_full_crew | |
| mock_crew_instance = MagicMock() | |
| mock_crew_instance.kickoff.return_value = "Mocked itinerary" | |
| mock_crew_cls.return_value = mock_crew_instance | |
| trip = TripRequest( | |
| from_city="Cairo", | |
| destination_city="Luxor", | |
| date_from="2026/6/19", | |
| date_to="2026/6/20", | |
| tags=["historical_site"], | |
| interests="history", | |
| ) | |
| result = run_full_crew(trip, "[]") | |
| assert result == "Mocked itinerary" | |
| mock_crew_instance.kickoff.assert_called_once() | |
| def test_run_events_only_crew(mock_crew_cls, mock_ev_task, mock_ev_agent): | |
| from app.services.inference import run_events_only_crew | |
| mock_crew_instance = MagicMock() | |
| mock_crew_instance.kickoff.return_value = '{"events": []}' | |
| mock_crew_cls.return_value = mock_crew_instance | |
| trip = TripRequest( | |
| from_city="Cairo", | |
| destination_city="Luxor", | |
| date_from="2026/6/19", | |
| date_to="2026/6/20", | |
| tags=[], | |
| interests="sightseeing", | |
| ) | |
| result = run_events_only_crew(trip) | |
| assert result == '{"events": []}' | |