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:
parent
a2745c1478
commit
43f9d210fb
3 changed files with 26 additions and 7 deletions
|
|
@ -18,7 +18,7 @@ class TestSetDecision:
|
|||
)
|
||||
assert result.decision == "liked"
|
||||
repo.upsert_decision.assert_called_once_with(
|
||||
user_id=1, listing_id=100, listing_type="RENT", decision="liked"
|
||||
1, 100, "RENT", "liked"
|
||||
)
|
||||
|
||||
def test_set_disliked(self) -> None:
|
||||
|
|
@ -58,7 +58,7 @@ class TestGetDecisions:
|
|||
listing_type="RENT", decision="liked",
|
||||
),
|
||||
]
|
||||
result = decision_service.get_decisions(repo, user_id=1)
|
||||
result = decision_service.get_user_decisions(repo, user_id=1)
|
||||
assert len(result) == 1
|
||||
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class TestClearDecision:
|
|||
def test_clear_existing(self) -> None:
|
||||
repo = MagicMock()
|
||||
repo.delete_decision.return_value = True
|
||||
result = decision_service.clear_decision(
|
||||
result = decision_service.remove_decision(
|
||||
repo, user_id=1, listing_id=100, listing_type="RENT"
|
||||
)
|
||||
assert result is True
|
||||
|
|
@ -74,7 +74,7 @@ class TestClearDecision:
|
|||
def test_clear_nonexistent(self) -> None:
|
||||
repo = MagicMock()
|
||||
repo.delete_decision.return_value = False
|
||||
result = decision_service.clear_decision(
|
||||
result = decision_service.remove_decision(
|
||||
repo, user_id=1, listing_id=100, listing_type="RENT"
|
||||
)
|
||||
assert result is False
|
||||
|
|
@ -84,7 +84,7 @@ class TestGetDislikedListingIds:
|
|||
def test_returns_disliked_set(self) -> None:
|
||||
repo = MagicMock()
|
||||
repo.get_disliked_listing_ids.return_value = {200, 300}
|
||||
result = decision_service.get_disliked_listing_ids(
|
||||
result = decision_service.get_disliked_ids(
|
||||
repo, user_id=1, listing_type="RENT"
|
||||
)
|
||||
assert result == {200, 300}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue