tests: Update tests according to previous changes with `expand_path()`

This commit is contained in:
Shreya 2021-07-06 19:46:02 +05:30
parent 96c3a2ed12
commit c802914cf6
2 changed files with 17 additions and 15 deletions

View File

@ -0,0 +1,17 @@
import os
from common.utils.file_utils import expand_path
def test_expand_user(mock_home_env):
input_path = os.path.join("~", "test")
expected_path = os.path.join(mock_home_env, "test")
assert expand_path(input_path) == expected_path
def test_expand_vars(mock_home_env):
input_path = os.path.join("$HOME", "test")
expected_path = os.path.join(mock_home_env, "test")
assert expand_path(input_path) == expected_path

View File

@ -6,26 +6,11 @@ from tests.monkey_island.utils import assert_windows_permissions
from monkey_island.cc.server_utils.file_utils import (
create_secure_directory,
expand_path,
is_windows_os,
open_new_securely_permissioned_file,
)
def test_expand_user(patched_home_env):
input_path = os.path.join("~", "test")
expected_path = os.path.join(patched_home_env, "test")
assert 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 expand_path(input_path) == expected_path
@pytest.fixture
def test_path_nested(tmpdir):
path = os.path.join(tmpdir, "test1", "test2", "test3")