mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-17 18:38:46 -05:00
ed934100a0
Four integration tests fell behind code changes in app/integrations/ and app/models. They were asserting against the old data shapes / patching the old mock targets and only surfaced now that v5.5.6's fixture refresh re-enabled them. ### tests/test_integration/test_caldav_integration.py test_sync_data_imports_events still expected the connector to write TimeEntry rows and IntegrationExternalEventLink rows. The connector in app/integrations/caldav_calendar.py:803 now writes CalendarEvent rows and tracks imports via a [CalDAV: <uid>] marker embedded in the description. Update the assertions to query CalendarEvent and look for the marker. Add CalendarEvent to the model imports. ### tests/test_integration/test_activitywatch_integration.py Four tests in this file patched `app.integrations.activitywatch.requests.get`. The connector at app/integrations/activitywatch.py:78-79 was refactored to route HTTP through `integration_session()` + `session_request()`, so requests.get is never called and the mocks never fire. Tests that relied on the mock then attempted real HTTP to localhost:5600 and failed. Repoint all four @patch decorators to `app.integrations.activitywatch.session_request`. Update the one positional-argument assertion in test_test_connection_success — the URL moves from arg[0] to arg[2] because session_request's signature is (session, method, url, **kw). ### tests/test_custom_field_definitions.py test_delete_custom_field_preserves_other_fields called `test_client.set_custom_field(...)` directly on the fixture instance which may belong to a different SQLAlchemy session by the time the test runs. The two JSON mutations weren't reliably persisted, so only one of the two fields survived to the assertions. Re-query the client via `Client.query.get(test_client.id)` before mutating — matches the pattern already used in the surrounding tests in the same file. Test plan - pytest tests/test_integration/test_caldav_integration.py::TestCalDAVConnector::test_sync_data_imports_events - pytest tests/test_integration/test_activitywatch_integration.py::TestActivityWatchConnector - pytest tests/test_custom_field_definitions.py::test_delete_custom_field_preserves_other_fields