mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
test: add regression assertion for health-probe get(limit=1) and guard against query()
This commit is contained in:
parent
1397063c30
commit
9d150d1d95
1 changed files with 4 additions and 1 deletions
|
|
@ -267,7 +267,7 @@ class TestAssertCollectionsHealthy:
|
|||
|
||||
@patch("paperforge.commands.embed.get_collection")
|
||||
def test_healthy_collections(self, mock_get_collection):
|
||||
"""Three healthy collections -> (True, '')."""
|
||||
"""Three healthy collections -> (True, ''). Ensure get(limit=1) is called, query is not."""
|
||||
mock_col = MagicMock()
|
||||
mock_col.count.return_value = 42
|
||||
mock_get_collection.return_value = mock_col
|
||||
|
|
@ -275,6 +275,9 @@ class TestAssertCollectionsHealthy:
|
|||
ok, msg = _assert_collections_healthy(Path("/vault"))
|
||||
assert ok is True
|
||||
assert msg == ""
|
||||
# Regression: get(limit=1) must be called; query must not be called
|
||||
mock_col.get.assert_called_with(limit=1)
|
||||
assert mock_col.query.call_count == 0
|
||||
|
||||
@patch("paperforge.commands.embed.get_collection")
|
||||
def test_corrupted_collection(self, mock_get_collection):
|
||||
|
|
|
|||
Loading…
Reference in a new issue