island: Add `dir_is_empty()` to clarify intent of `test_remove_pba_files()`

This commit is contained in:
Mike Salvatore 2021-05-12 08:10:01 -04:00
parent e3449d17c7
commit db14285934
1 changed files with 6 additions and 5 deletions

View File

@ -25,13 +25,14 @@ def test_remove_pba_files():
create_custom_pba_file("linux_file")
create_custom_pba_file("windows_file")
custom_pda_dir_contents = os.listdir(PostBreachFilesService.get_custom_pba_directory())
assert len(custom_pda_dir_contents) == 2
assert not dir_is_empty(PostBreachFilesService.get_custom_pba_directory())
PostBreachFilesService.remove_PBA_files()
assert dir_is_empty(PostBreachFilesService.get_custom_pba_directory())
custom_pda_dir_contents = os.listdir(PostBreachFilesService.get_custom_pba_directory())
assert len(custom_pda_dir_contents) == 0
def dir_is_empty(dir_path):
dir_contents = os.listdir(dir_path)
return len(dir_contents) == 0
@pytest.mark.skipif(os.name != "posix", reason="Tests Posix (not Windows) permissions.")