forked from p15670423/monkey
UT: Add tests for delete_files_by_pattern() in LocalStorageFileRepository
This commit is contained in:
parent
6aae63f9fc
commit
885a907287
|
@ -143,3 +143,14 @@ def test_open_locked_file(tmp_path, monkeypatch):
|
|||
with patch("builtins.open", Mock(side_effect=Exception())):
|
||||
with pytest.raises(repository.RetrievalError):
|
||||
fss.open_file("locked_file.txt")
|
||||
|
||||
|
||||
def test_delete_files_by_pattern(tmp_path):
|
||||
for filename in ["xyz-1.txt", "abc-2.txt", "pqr-3.txt", "abc-4.txt"]:
|
||||
(tmp_path / filename).touch()
|
||||
|
||||
fss = LocalStorageFileRepository(tmp_path)
|
||||
fss.delete_files_by_pattern("abc-*")
|
||||
|
||||
files = list(tmp_path.iterdir())
|
||||
assert len(files) == 2
|
||||
|
|
Loading…
Reference in New Issue