From 30d3124cb46640c43aaa9e9e855f45c26d653837 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 28 Sep 2022 18:14:48 +0530 Subject: [PATCH] UT: Fix assert logic in test_delete_files_by_pattern() --- .../cc/repository/test_local_storage_file_repository.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py b/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py index c03d615f9..03fa1f5ca 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py +++ b/monkey/tests/unit_tests/monkey_island/cc/repository/test_local_storage_file_repository.py @@ -146,11 +146,11 @@ def test_open_locked_file(tmp_path, monkeypatch): def test_delete_files_by_pattern(tmp_path): - for filename in ["xyz-1.txt", "abc-2.txt", "pqr-3.txt", "abc-4.txt"]: + for filename in {"xyz-1.txt", "abc-2.txt", "pqr-3.txt", "abc-4.txt", "abc-5.pdf"}: (tmp_path / filename).touch() fss = LocalStorageFileRepository(tmp_path) - fss.delete_files_by_pattern("abc-*") + fss.delete_files_by_pattern("abc-*.txt") - files = list(tmp_path.iterdir()) - assert len(files) == 2 + files = {f.name for f in tmp_path.iterdir()} + assert files == {"xyz-1.txt", "pqr-3.txt", "abc-5.pdf"}