fix: QA fixes for property decisions feature
- Replace deprecated datetime.utcnow() with datetime.now(UTC) in model and repository - Add listing_type validation to decision_service (RENT/BUY only) - Fix decision filtering tests failing due to rate limiting by patching _match_endpoint - Add SwipeCard component test suite (11 tests covering rendering, interactions, and POI distances) - Add test for invalid listing_type validation
This commit is contained in:
parent
8452f65d25
commit
49280d9679
6 changed files with 149 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""Test that disliked listings are filtered from the GeoJSON endpoint."""
|
||||
import pytest
|
||||
from datetime import datetime
|
||||
from unittest.mock import patch
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
from sqlalchemy import Engine
|
||||
from sqlmodel import SQLModel, Session, create_engine
|
||||
|
|
@ -73,8 +74,9 @@ async def filter_client(filter_engine: Engine) -> AsyncClient:
|
|||
poi_routes_mod.engine = filter_engine
|
||||
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as c:
|
||||
yield c # type: ignore[misc]
|
||||
with patch("api.rate_limiter._match_endpoint", return_value=None):
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as c:
|
||||
yield c # type: ignore[misc]
|
||||
|
||||
database.engine = original_db
|
||||
api_app.engine = original_app
|
||||
|
|
|
|||
|
|
@ -40,6 +40,14 @@ class TestSetDecision:
|
|||
listing_type="RENT", decision="maybe",
|
||||
)
|
||||
|
||||
def test_invalid_listing_type_raises(self) -> None:
|
||||
repo = MagicMock()
|
||||
with pytest.raises(ValueError, match="Invalid listing_type"):
|
||||
decision_service.set_decision(
|
||||
repo, user_id=1, listing_id=100,
|
||||
listing_type="SELL", decision="liked",
|
||||
)
|
||||
|
||||
|
||||
class TestGetDecisions:
|
||||
def test_returns_all_decisions(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue