Exemplo n.º 1
0
def test_lock():
    """
    Test rebootmgr.lock without parameters
    """
    salt_mock = {
        "cmd.run_all": MagicMock(return_value={
            "stdout": "output",
            "retcode": 0
        })
    }
    with patch.dict(rebootmgr.__salt__, salt_mock):
        assert rebootmgr.lock() == "output"
        salt_mock["cmd.run_all"].assert_called_with(["rebootmgrctl", "lock"])
Exemplo n.º 2
0
def test_lock_machine_id_group():
    """
    Test rebootmgr.lock with machine_id and group parameters
    """
    salt_mock = {
        "cmd.run_all": MagicMock(return_value={
            "stdout": "output",
            "retcode": 0
        })
    }
    with patch.dict(rebootmgr.__salt__, salt_mock):
        assert rebootmgr.lock("machine-id", "group1") == "output"
        salt_mock["cmd.run_all"].assert_called_with(
            ["rebootmgrctl", "lock", "--group", "group1", "machine-id"])