Modify unit tests: tests/infection_monkey/utils/linux/test_users.py

This commit is contained in:
Shreya 2021-04-25 00:31:21 +05:30 committed by Mike Salvatore
parent 410cbadbb3
commit 9602a67d28
1 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ TEST_USER = "test_user"
@pytest.fixture
def subprocess_check_output_spy(monkeypatch):
def mock_check_output(command, stderr, shell):
def mock_check_output(command, stderr):
mock_check_output.command = command
mock_check_output.command = ""
@ -21,11 +21,11 @@ def subprocess_check_output_spy(monkeypatch):
def test_new_user_expires(subprocess_check_output_spy):
with (AutoNewLinuxUser(TEST_USER, "password")):
assert "--expiredate" in subprocess_check_output_spy.command
assert "--inactive 0" in subprocess_check_output_spy.command
assert "--expiredate" in " ".join(subprocess_check_output_spy.command)
assert "--inactive 0" in " ".join(subprocess_check_output_spy.command)
def test_new_user_try_delete(subprocess_check_output_spy):
with (AutoNewLinuxUser(TEST_USER, "password")):
pass
assert f"deluser {TEST_USER}" in subprocess_check_output_spy.command
assert f"deluser {TEST_USER}" in " ".join(subprocess_check_output_spy.command)