Exemplo n.º 1
0
def test_reboot_invalid():
    """
    Test rebootmgr.reboot with invalid parameter
    """
    salt_mock = {
        "cmd.run_all": MagicMock(return_value={
            "stdout": "output",
            "retcode": 0
        })
    }
    with patch.dict(rebootmgr.__salt__, salt_mock):
        with pytest.raises(CommandExecutionError):
            rebootmgr.reboot("invalid")
Exemplo n.º 2
0
def test_reboot():
    """
    Test rebootmgr.reboot without parameters
    """
    salt_mock = {
        "cmd.run_all": MagicMock(return_value={
            "stdout": "output",
            "retcode": 0
        })
    }
    with patch.dict(rebootmgr.__salt__, salt_mock):
        assert rebootmgr.reboot() == "output"
        salt_mock["cmd.run_all"].assert_called_with(["rebootmgrctl", "reboot"])