# Task: Fix test watchlist fixture for sector rotation tests ## Goal Fix the `watchlist` fixture in `tests/conftest.py` so that sector rotation tests can properly create and use watchlists with user ownership. ## Root Cause The `watchlist` fixture in `conftest.py` sets `user_id: "test-user-1"` but the `test_user` fixture generates a UUID for `user_id`. When the rotation service calls `_require_watchlist_owner`, the user IDs don't match, causing 404 errors. ## Requirements ### Fix in `src/backend/tests/conftest.py` 1. In the `watchlist` fixture, use the same user ID as `test_user`: - Extract the user ID from `test_user` fixture's UUID - Or use a fixed user ID like `"test-user-1"` in both fixtures 2. Ensure the fixture returns a watchlist dict with: - `id`: a consistent UUID (not random per test) - `user_id`: matching the test user's ID - `name`, `description`, `is_default`: reasonable defaults ### Alternative: Fix in rotation service tests If the fixture approach is too invasive, fix the rotation service tests to use the correct user ID when calling endpoints. ## Acceptance Criteria 1. The `watchlist` fixture's `user_id` matches the `test_user` fixture's user ID 2. Sector rotation tests that create watchlists pass 3. No regressions in existing alert tests ## Files to Modify - `src/backend/tests/conftest.py` ## Files to Read First - `src/backend/tests/conftest.py` — the `watchlist` and `test_user` fixtures - `src/backend/tests/test_sector_rotation.py` — tests that depend on the fixture - `src/backend/services/rotation_service.py` — how ownership is checked