From 6b4a0906c0ab320f7a35c1bb379b6eb25ed87849 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 15 Jun 2021 09:31:22 -0400 Subject: [PATCH] island: use constants for permissions mode in test_file_utils.py --- .../monkey_island/cc/server_utils/test_file_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 0c5b7348e..ddb4c4936 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 @@ -70,7 +70,11 @@ def test_create_secure_directory__no_parent_dir(test_path_nested): def test_create_secure_directory__perm_linux(test_path): create_secure_directory(test_path) st = os.stat(test_path) - assert (st.st_mode & 0o777) == stat.S_IRWXU + + expected_mode = stat.S_IRWXU + actual_mode = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + + assert expected_mode == actual_mode @pytest.mark.skipif(not is_windows_os(), reason="Tests Windows (not Posix) permissions.")