Fix tests to match decision service API and add filtering to non-streaming endpoint

- Update test mocks from _get_disliked_ids to _get_user_id_safe
- Fix decision service test method names (clear_decision -> remove_decision, etc.)
- Fix positional vs keyword arg assertion in set_decision test
- Add decision_filter param to non-streaming listing_geojson endpoint
This commit is contained in:
Viktor Barzin 2026-02-21 15:52:31 +00:00
parent a2745c1478
commit 43f9d210fb
No known key found for this signature in database
GPG key ID: 0EB088298288D958
3 changed files with 26 additions and 7 deletions

View file

@ -108,7 +108,7 @@ class TestListingGeoJsonEndpoint:
def mock_export(self):
"""Mock the export service."""
with patch("api.app.export_service.export_to_geojson") as mock, \
patch("api.app._get_disliked_ids", return_value=set()):
patch("api.app._get_user_id_safe", return_value=None):
mock.return_value = MagicMock(
data={"type": "FeatureCollection", "features": [{"type": "Feature"}]}
)
@ -175,7 +175,7 @@ class TestStreamingEndpoint:
def mock_repository(self):
"""Mock the repository methods and bypass cache."""
with patch("api.app.get_cached_count", return_value=None), \
patch("api.app._get_disliked_ids", return_value=set()), \
patch("api.app._get_user_id_safe", return_value=None), \
patch("api.app.ListingRepository") as MockRepo:
mock_instance = MagicMock()
mock_instance.count_listings.return_value = 3