Skip to content

Commit 693dcdd

Browse files
committed
Removes no longer required combined test
1 parent 87719dc commit 693dcdd

File tree

1 file changed

+1
-48
lines changed

1 file changed

+1
-48
lines changed

tests/test_saltworker.py

+1-48
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414

1515
import pytest
1616

17-
from watchmaker.exceptions import (
18-
InvalidComputerNameError,
19-
InvalidValue,
20-
OuPathRequired,
21-
)
17+
from watchmaker.exceptions import InvalidValue, OuPathRequired
2218
from watchmaker.workers.salt import SaltBase, SaltLinux, SaltWindows
2319

2420
# Supports Python2 and Python3 test mocks
@@ -991,46 +987,3 @@ def test_linux_computer_name_patt_none():
991987

992988
# assertions ===================
993989
assert saltworker_lx._set_grain.call_count == 2
994-
995-
996-
def test_linux_computer_name_patt():
997-
"""Test that valid names match pattern and invalid do not."""
998-
# setup ========================
999-
system_params = {}
1000-
salt_config = {}
1001-
system_params["prepdir"] = "662f1bdb-5992-5f8f-87d6-15c4de958b7b"
1002-
system_params["logdir"] = "76b74ceb-e81d-5fac-b293-0d7d45901ef7"
1003-
system_params["workingdir"] = "4e6a1827-1d3b-5612-a7fd-f6fed00b5a2f"
1004-
1005-
# try "normal" first, with a valid computer. try with invalid below.
1006-
salt_config["computer_name"] = "xyz654abcdefghe"
1007-
salt_config["computer_name_pattern"] = r"(?i)xyz[\d]{3}[a-z]{8}[ex]"
1008-
1009-
# execution ====================
1010-
saltworker_lx = SaltLinux(system_params, **salt_config)
1011-
1012-
saltworker_lx._set_grain = MagicMock(return_value=None)
1013-
saltworker_lx.run_salt = MagicMock(
1014-
return_value={"retcode": 0, "stdout": b"", "stderr": b""}
1015-
)
1016-
1017-
saltworker_lx.process_grains()
1018-
1019-
# assertions ===================
1020-
assert saltworker_lx._set_grain.call_count == 4
1021-
saltworker_lx._set_grain.assert_called_with(
1022-
'name-computer', {'pattern': salt_config["computer_name_pattern"]})
1023-
1024-
# tried "normal" first, with a value, above. now, trying with none.
1025-
salt_config["computer_name"] = "123654abcdefghlmdone"
1026-
1027-
# execution ====================
1028-
saltworker_lx = SaltLinux(system_params, **salt_config)
1029-
1030-
saltworker_lx._set_grain = MagicMock(return_value=None)
1031-
saltworker_lx.run_salt = MagicMock(
1032-
return_value={"retcode": 0, "stdout": b"", "stderr": b""}
1033-
)
1034-
1035-
with pytest.raises(InvalidComputerNameError):
1036-
saltworker_lx.before_install()

0 commit comments

Comments
 (0)