fix: event-log route handles missing location_id

The /event-log route now shows a location selector dropdown instead of
returning a 422 error when no location_id is provided. This follows the
same pattern used by the Eggs page.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-01 07:56:37 +00:00
parent 64bb99aa64
commit c8f026fb2a
3 changed files with 84 additions and 24 deletions

View File

@@ -107,10 +107,12 @@ def create_cohort(animal_service, location_id, count=3):
class TestEventLogRoute:
"""Tests for GET /event-log route."""
def test_event_log_requires_location_id(self, client):
"""Event log requires location_id parameter."""
def test_event_log_without_location_shows_selector(self, client):
"""Event log without location_id shows location selector."""
response = client.get("/event-log")
assert response.status_code == 422
assert response.status_code == 200
# Should show location selector prompt
assert "Select a location" in response.text
def test_event_log_returns_empty_for_new_location(self, client, valid_location_id):
"""Event log returns empty state for location with no events."""