From a572f97ea36b20a9d1f564bd6e30d82db69fa5fc Mon Sep 17 00:00:00 2001 From: islean Date: Thu, 11 Jan 2024 15:01:36 +0100 Subject: [PATCH] Fix tests --- tests/meta/clean/test_clean_retrieved_spring_files.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/meta/clean/test_clean_retrieved_spring_files.py b/tests/meta/clean/test_clean_retrieved_spring_files.py index 24e28bf4c8..4312122c6d 100644 --- a/tests/meta/clean/test_clean_retrieved_spring_files.py +++ b/tests/meta/clean/test_clean_retrieved_spring_files.py @@ -31,7 +31,7 @@ def test_get_files_to_remove( def test_clean_retrieved_spring_files_dry_run( populated_clean_retrieved_spring_files_api: CleanRetrievedSpringFilesAPI, path_to_old_retrieved_spring_file: str, - path_to_old_retrieved_spring_file_in_housekeeper: str, + retrieved_test_bundle_name: str, caplog, ): """Tests that only the Spring file with an old enough 'retrieved_at' would be removed when cleaning retrieved @@ -41,10 +41,15 @@ def test_clean_retrieved_spring_files_dry_run( # GIVEN a CleanRetrievedSpringFilesAPI with a populated Housekeeper database # GIVEN that an old retrieved file exists - Path(path_to_old_retrieved_spring_file_in_housekeeper).touch() + for file in populated_clean_retrieved_spring_files_api.housekeeper_api.get_files( + bundle=retrieved_test_bundle_name + ): + if path_to_old_retrieved_spring_file in file.path: + file_path: str = file.path + Path(file_path).touch() # WHEN running 'clean_retrieved_spring_files' populated_clean_retrieved_spring_files_api.clean_retrieved_spring_files(age_limit=7) # THEN the file with an old enough 'retrieved_at' should have been removed - assert not Path(path_to_old_retrieved_spring_file_in_housekeeper).exists() + assert not Path(file_path).exists()