forked from p15670423/monkey
tests: Update tests according to previous changes with `expand_path()`
This commit is contained in:
parent
96c3a2ed12
commit
c802914cf6
|
@ -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
|
|
@ -6,26 +6,11 @@ from tests.monkey_island.utils import assert_windows_permissions
|
||||||
|
|
||||||
from monkey_island.cc.server_utils.file_utils import (
|
from monkey_island.cc.server_utils.file_utils import (
|
||||||
create_secure_directory,
|
create_secure_directory,
|
||||||
expand_path,
|
|
||||||
is_windows_os,
|
is_windows_os,
|
||||||
open_new_securely_permissioned_file,
|
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
|
@pytest.fixture
|
||||||
def test_path_nested(tmpdir):
|
def test_path_nested(tmpdir):
|
||||||
path = os.path.join(tmpdir, "test1", "test2", "test3")
|
path = os.path.join(tmpdir, "test1", "test2", "test3")
|
||||||
|
|
Loading…
Reference in New Issue