From 44bdfa5508c76f87d1a8b016cb6e3dcbce53bef9 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 15 Jun 2021 13:14:31 -0400 Subject: [PATCH] island: Rename create_secure_file tests create_secure_file() was previously renamed to get_file_descriptor_for_new_secure_file(). --- .../monkey_island/cc/server_utils/test_file_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py b/monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py index 7e3e10ed6..ab1c77ed1 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py +++ b/monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py @@ -56,7 +56,7 @@ def _get_acl_and_sid_from_path(path: str): return acl, sid -def test_create_secure_directory__already_created(test_path): +def test_create_secure_directory__already_exists(test_path): os.mkdir(test_path) assert os.path.isdir(test_path) create_secure_directory(test_path) @@ -95,7 +95,7 @@ def test_create_secure_directory__perm_windows(test_path): assert permissions == FULL_CONTROL and ace_type == ACE_TYPE_ALLOW -def test_create_secure_file__already_created(test_path): +def test_get_file_descriptor_for_new_secure_file__already_exists(test_path): os.close(os.open(test_path, os.O_CREAT, stat.S_IRWXU)) assert os.path.isfile(test_path) @@ -103,13 +103,13 @@ def test_create_secure_file__already_created(test_path): get_file_descriptor_for_new_secure_file(test_path) -def test_create_secure_file__no_parent_dir(test_path_nested): +def test_get_file_descriptor_for_new_secure_file__no_parent_dir(test_path_nested): with pytest.raises(Exception): get_file_descriptor_for_new_secure_file(test_path_nested) @pytest.mark.skipif(is_windows_os(), reason="Tests Posix (not Windows) permissions.") -def test_create_secure_file__perm_linux(test_path): +def test_get_file_descriptor_for_new_secure_file__perm_linux(test_path): os.close(get_file_descriptor_for_new_secure_file(test_path)) st = os.stat(test_path) @@ -120,7 +120,7 @@ def test_create_secure_file__perm_linux(test_path): @pytest.mark.skipif(not is_windows_os(), reason="Tests Windows (not Posix) permissions.") -def test_create_secure_file__perm_windows(test_path): +def test_get_file_descriptor_for_new_secure_file__perm_windows(test_path): win32file.CloseHandle(get_file_descriptor_for_new_secure_file(test_path)) acl, user_sid = _get_acl_and_sid_from_path(test_path)