Merge pull request 'fix(tradein): починить 3 теста-регрессии из #1543 — разблокировать deploy gate' (#1548) from fix/week-review-test-regressions into main
All checks were successful
Deploy Trade-In / changes (push) Successful in 6s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / deploy (push) Successful in 44s
Deploy Trade-In / test (push) Successful in 32s
Deploy Trade-In / build-backend (push) Successful in 52s
All checks were successful
Deploy Trade-In / changes (push) Successful in 6s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / deploy (push) Successful in 44s
Deploy Trade-In / test (push) Successful in 32s
Deploy Trade-In / build-backend (push) Successful in 52s
Reviewed-on: #1548
This commit is contained in:
commit
aab07845f6
3 changed files with 14 additions and 1 deletions
|
|
@ -258,9 +258,18 @@ 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.get_scraper_delay", return_value=0.0),
|
||||
):
|
||||
# Call 1: SELECT listings → .mappings().all()
|
||||
mock_listings_result = MagicMock()
|
||||
mock_mappings = MagicMock()
|
||||
mock_mappings.all.return_value = rows
|
||||
mock_db.execute.return_value.mappings.return_value = mock_mappings
|
||||
mock_listings_result.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)
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ def test_match_house_tier0_cadastr():
|
|||
[
|
||||
None, # pg_advisory_xact_lock
|
||||
{"id": 42}, # cadastral match
|
||||
None, # _insert_alias (added by #1543: register fp/addr alias after cadastr_exact)
|
||||
None, # _upsert_house_source (INSERT ... ON CONFLICT)
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -312,6 +312,9 @@ class _ExecuteCapture:
|
|||
def commit(self) -> None:
|
||||
pass
|
||||
|
||||
def rollback(self) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pull_sber_indices_upsert_on_conflict_idempotent() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue