diff options
Diffstat (limited to 'tests/unittests/config/test_cc_set_passwords.py')
-rw-r--r-- | tests/unittests/config/test_cc_set_passwords.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/unittests/config/test_cc_set_passwords.py b/tests/unittests/config/test_cc_set_passwords.py index f6885b2b..1a9fcd3c 100644 --- a/tests/unittests/config/test_cc_set_passwords.py +++ b/tests/unittests/config/test_cc_set_passwords.py @@ -20,8 +20,12 @@ LOG = logging.getLogger(__name__) SYSTEMD_CHECK_CALL = mock.call( ["systemctl", "show", "--property", "ActiveState", "--value", "ssh"] ) -SYSTEMD_RESTART_CALL = mock.call(["systemctl", "restart", "ssh"], capture=True) -SERVICE_RESTART_CALL = mock.call(["service", "ssh", "restart"], capture=True) +SYSTEMD_RESTART_CALL = mock.call( + ["systemctl", "restart", "ssh"], capture=True, rcs=None +) +SERVICE_RESTART_CALL = mock.call( + ["service", "ssh", "restart"], capture=True, rcs=None +) @pytest.fixture(autouse=True) @@ -46,7 +50,6 @@ class TestHandleSSHPwauth: (True, True, "activating"), (True, True, "inactive"), (True, False, None), - (False, True, None), (False, False, None), ), ) @@ -79,10 +82,6 @@ class TestHandleSSHPwauth: assert SYSTEMD_RESTART_CALL in m_subp.call_args_list else: assert SYSTEMD_RESTART_CALL not in m_subp.call_args_list - else: - assert SERVICE_RESTART_CALL in m_subp.call_args_list - assert SYSTEMD_CHECK_CALL not in m_subp.call_args_list - assert SYSTEMD_RESTART_CALL not in m_subp.call_args_list @mock.patch(f"{MODPATH}update_ssh_config", return_value=True) @mock.patch("cloudinit.distros.subp.subp") @@ -728,6 +727,3 @@ class TestSetPasswordsSchema: def test_schema_validation(self, config, expectation): with expectation: validate_cloudconfig_schema(config, get_schema(), strict=True) - - -# vi: ts=4 expandtab |