示例#1
0
文件: test_dom0.py 项目: 0b10/qsm
def test_not_exists_or_throws_throws_for_unexpected_exit_code():
    # returncode 2 is "domain not found"
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(237687263),
               autospec=True):
        with pytest.raises(lib.QsmProcessError):
            dom0.exists("fedora-template")
示例#2
0
文件: test_dom0.py 项目: 0b10/qsm
def test_create_exists_ok_throws_when_unexpected_exit_code():
    # run should exit(2) when vm doesn't exist, so any exit code other than that
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(273863),
               autospec=True):
        with pytest.raises(lib.QsmProcessError):
            dom0.create("fedora-template", "red", exists_ok=True)
示例#3
0
文件: test_dom0.py 项目: 0b10/qsm
def test_is_stopped_or_throws_throws_for_unexpected_exit_code():
    # returncode 1 is "domain is running"
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(7612736),
               autospec=True):
        with pytest.raises(lib.QsmProcessError):
            dom0.is_stopped_or_throws("fedora-template")
示例#4
0
文件: test_dom0.py 项目: 0b10/qsm
def test__is_template__false():
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(1),
               autospec=True):
        assert dom0.is_template("test-template") is False
示例#5
0
文件: test_dom0.py 项目: 0b10/qsm
def test_exists_returns_false_when_vm_doesnt_exist():
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(QVM_CHECK_EXISTS_NOT_FOUND),
               autospec=True):
        assert dom0.exists("fedora-template") is False
示例#6
0
文件: test_dom0.py 项目: 0b10/qsm
def test_is_running_returns_false_when_vm_isnt_running():
    with patch("qsm.dom0.lib.run",
               side_effect=lib.QsmProcessError(QVM_CHECK_IS_NOT_RUNNING),
               autospec=True):
        assert dom0.is_running("fedora-template") is False