test(trash): update model-count assertions after Event removal
CI & Build / Python lint (push) Successful in 3s
CI & Build / integration (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 53s
CI & Build / Build & push image (push) Successful in 1m12s
CI & Build / Python lint (push) Successful in 3s
CI & Build / integration (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 53s
CI & Build / Build & push image (push) Successful in 1m12s
restore() / purge_expired() now iterate 6 soft-deletable models (Note, Project, Milestone, Rulebook, RulebookTopic, Rule) — Event was removed with the calendar surface. Adjust the two count-coupled assertions (execute.await_count 7→6; the rowcount list drops a zero so the sum stays 4). Caught by CI run #2580. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BPtbSzA4JLMAKgFZ8VTg7Q
This commit is contained in:
@@ -97,14 +97,14 @@ def _rowcount_result(n):
|
||||
@pytest.mark.asyncio
|
||||
async def test_restore_clears_batch_across_all_models():
|
||||
session = _make_mock_session()
|
||||
# 7 models, each returns a rowcount
|
||||
session.execute = AsyncMock(side_effect=[_rowcount_result(i) for i in [2, 0, 1, 1, 0, 0, 0]])
|
||||
# 6 soft-deletable models, each returns a rowcount
|
||||
session.execute = AsyncMock(side_effect=[_rowcount_result(i) for i in [2, 0, 1, 1, 0, 0]])
|
||||
with patch("scribe.services.trash.async_session") as cls:
|
||||
cls.return_value = session
|
||||
from scribe.services.trash import restore
|
||||
n = await restore(user_id=1, batch_id="abc")
|
||||
assert n == 4
|
||||
assert session.execute.await_count == 7
|
||||
assert session.execute.await_count == 6
|
||||
assert session.commit.called
|
||||
|
||||
|
||||
@@ -123,13 +123,13 @@ async def test_purge_expired_skips_when_retention_zero():
|
||||
@pytest.mark.asyncio
|
||||
async def test_purge_expired_deletes_across_models_when_positive():
|
||||
session = _make_mock_session()
|
||||
session.execute = AsyncMock(side_effect=[_rowcount_result(1) for _ in range(7)])
|
||||
session.execute = AsyncMock(side_effect=[_rowcount_result(1) for _ in range(6)])
|
||||
with patch("scribe.services.trash.async_session") as cls:
|
||||
cls.return_value = session
|
||||
from scribe.services.trash import purge_expired
|
||||
n = await purge_expired(1, 90)
|
||||
assert n == 7
|
||||
assert session.execute.await_count == 7
|
||||
assert n == 6
|
||||
assert session.execute.await_count == 6
|
||||
|
||||
|
||||
def test_owner_clause_scopes_every_model():
|
||||
|
||||
Reference in New Issue
Block a user