Compare commits
No commits in common. "aab07845f6b9de52e9960eb34e1bcba4f57f9c66" and "7d39aebbd43ef8fb5a960a8edacfe3b89d8798d0" have entirely different histories.
aab07845f6
...
7d39aebbd4
3 changed files with 1 additions and 14 deletions
|
|
@ -258,18 +258,9 @@ async def test_cian_price_history_saves_changes():
|
||||||
patch("app.services.cian_price_history.save_detail_enrichment") as mock_save,
|
patch("app.services.cian_price_history.save_detail_enrichment") as mock_save,
|
||||||
patch("app.services.cian_price_history.get_scraper_delay", return_value=0.0),
|
patch("app.services.cian_price_history.get_scraper_delay", return_value=0.0),
|
||||||
):
|
):
|
||||||
# Call 1: SELECT listings → .mappings().all()
|
|
||||||
mock_listings_result = MagicMock()
|
|
||||||
mock_mappings = MagicMock()
|
mock_mappings = MagicMock()
|
||||||
mock_mappings.all.return_value = rows
|
mock_mappings.all.return_value = rows
|
||||||
mock_listings_result.mappings.return_value = mock_mappings
|
mock_db.execute.return_value.mappings.return_value = mock_mappings
|
||||||
# Call 2: SELECT COUNT(*) before save → scalar_one() == 0
|
|
||||||
mock_before_result = MagicMock()
|
|
||||||
mock_before_result.scalar_one.return_value = 0
|
|
||||||
# Call 3: SELECT COUNT(*) after save → scalar_one() == 2 (2 rows inserted)
|
|
||||||
mock_after_result = MagicMock()
|
|
||||||
mock_after_result.scalar_one.return_value = 2
|
|
||||||
mock_db.execute.side_effect = [mock_listings_result, mock_before_result, mock_after_result]
|
|
||||||
|
|
||||||
result = await backfill_cian_price_history(mock_db, batch_size=10)
|
result = await backfill_cian_price_history(mock_db, batch_size=10)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ def test_match_house_tier0_cadastr():
|
||||||
[
|
[
|
||||||
None, # pg_advisory_xact_lock
|
None, # pg_advisory_xact_lock
|
||||||
{"id": 42}, # cadastral match
|
{"id": 42}, # cadastral match
|
||||||
None, # _insert_alias (added by #1543: register fp/addr alias after cadastr_exact)
|
|
||||||
None, # _upsert_house_source (INSERT ... ON CONFLICT)
|
None, # _upsert_house_source (INSERT ... ON CONFLICT)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -312,9 +312,6 @@ class _ExecuteCapture:
|
||||||
def commit(self) -> None:
|
def commit(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def rollback(self) -> None:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_pull_sber_indices_upsert_on_conflict_idempotent() -> None:
|
async def test_pull_sber_indices_upsert_on_conflict_idempotent() -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue