diff --git a/monkey/monkey_island/cc/environment/utils.py b/monkey/monkey_island/cc/environment/utils.py index 62c8bb7d2..8efbb4492 100644 --- a/monkey/monkey_island/cc/environment/utils.py +++ b/monkey/monkey_island/cc/environment/utils.py @@ -46,6 +46,6 @@ def _create_secure_directory_windows(path: str): win32file.CreateDirectory(path, security_attributes) except Exception as ex: LOG.error( - f'Could not create a directory at "{path}": {str(ex)}" + f'Could not create a directory at "{path}": {str(ex)}' ) raise ex diff --git a/monkey/tests/unit_tests/monkey_island/cc/environment/test_utils.py b/monkey/tests/unit_tests/monkey_island/cc/environment/test_utils.py index aa4458c38..4d933af76 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/environment/test_utils.py +++ b/monkey/tests/unit_tests/monkey_island/cc/environment/test_utils.py @@ -1,4 +1,5 @@ import os +import stat import pytest @@ -30,6 +31,13 @@ def test_create_secure_directory__no_parent_dir(test_path_nested): create_secure_directory(test_path_nested) +@pytest.mark.skipif(is_windows_os(), reason="Tests Posix (not Windows) permissions.") +def test_create_secure_directory__perm_linux(test_path): + create_secure_directory(test_path) + st = os.stat(test_path) + return bool(st.st_mode & stat.S_IRWXU) + + @pytest.mark.skipif(not is_windows_os(), reason="Tests Windows (not Posix) permissions.") def test_create_secure_directory__perm_windows(test_path): import win32api