From bf0fe10ea9a66551eedfb5ca9ec9f728b50eea8f Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 7 Jun 2021 13:18:04 -0400 Subject: [PATCH] island: Add unit tests for expand_path() --- .../cc/server_utils/test_file_utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py 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 new file mode 100644 index 000000000..cff716135 --- /dev/null +++ b/monkey/tests/unit_tests/monkey_island/cc/server_utils/test_file_utils.py @@ -0,0 +1,17 @@ +import os + +from monkey_island.cc.server_utils import file_utils + + +def test_expand_user(patched_home_env): + input_path = os.path.join("~", "test") + expected_path = os.path.join(patched_home_env, "test") + + assert file_utils.expand_path(input_path) == expected_path + + +def test_expand_vars(patched_home_env): + input_path = os.path.join("$HOME", "test") + expected_path = os.path.join(patched_home_env, "test") + + assert file_utils.expand_path(input_path) == expected_path