Update tests to mock admin.vm.CurrentState
This commit is contained in:
parent
0659e372ee
commit
e5612592d4
@ -916,11 +916,11 @@ class TC_30_QubesRemote(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch('os.isatty', lambda fd: fd == 2)
|
@mock.patch('os.isatty', lambda fd: fd == 2)
|
||||||
def test_014_run_service_no_autostart1(self):
|
def test_014_run_service_no_autostart1(self):
|
||||||
self.set_proc_stdout( b'0\x00some-vm class=AppVM state=Running\n')
|
self.set_proc_stdout( b'0\x00power_state=Running')
|
||||||
self.app.run_service('some-vm', 'service.name', autostart=False)
|
self.app.run_service('some-vm', 'service.name', autostart=False)
|
||||||
self.proc_mock.assert_has_calls([
|
self.proc_mock.assert_has_calls([
|
||||||
call([qubesadmin.config.QREXEC_CLIENT_VM,
|
call([qubesadmin.config.QREXEC_CLIENT_VM,
|
||||||
'some-vm', 'admin.vm.List'],
|
'some-vm', 'admin.vm.CurrentState'],
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE),
|
stderr=subprocess.PIPE),
|
||||||
call().communicate(None),
|
call().communicate(None),
|
||||||
@ -932,11 +932,11 @@ class TC_30_QubesRemote(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch('os.isatty', lambda fd: fd == 2)
|
@mock.patch('os.isatty', lambda fd: fd == 2)
|
||||||
def test_015_run_service_no_autostart2(self):
|
def test_015_run_service_no_autostart2(self):
|
||||||
self.set_proc_stdout( b'0\x00some-vm class=AppVM state=Halted\n')
|
self.set_proc_stdout( b'0\x00power_state=Halted')
|
||||||
with self.assertRaises(qubesadmin.exc.QubesVMNotRunningError):
|
with self.assertRaises(qubesadmin.exc.QubesVMNotRunningError):
|
||||||
self.app.run_service('some-vm', 'service.name', autostart=False)
|
self.app.run_service('some-vm', 'service.name', autostart=False)
|
||||||
self.proc_mock.assert_called_once_with([
|
self.proc_mock.assert_called_once_with([
|
||||||
qubesadmin.config.QREXEC_CLIENT_VM,
|
qubesadmin.config.QREXEC_CLIENT_VM,
|
||||||
'some-vm', 'admin.vm.List'],
|
'some-vm', 'admin.vm.CurrentState'],
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -71,8 +71,8 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Running\n' \
|
b'some-vm2 class=AppVM state=Running\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qubesadmin.tools.qvm_check.main(['--running', 'some-vm'],
|
qubesadmin.tools.qvm_check.main(['--running', 'some-vm'],
|
||||||
@ -87,11 +87,11 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Running\n' \
|
b'some-vm2 class=AppVM state=Running\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm2', 'admin.vm.List', None, None)] = \
|
('some-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm2 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(qubesadmin.tools.qvm_check.main(
|
self.assertEqual(qubesadmin.tools.qvm_check.main(
|
||||||
['--running', 'some-vm', 'some-vm2'], app=self.app), 0)
|
['--running', 'some-vm', 'some-vm2'], app=self.app), 0)
|
||||||
@ -107,14 +107,14 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Running\n' \
|
b'some-vm2 class=AppVM state=Running\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm2', 'admin.vm.List', None, None)] = \
|
('some-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm2 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm3', 'admin.vm.List', None, None)] = \
|
('some-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm3 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qubesadmin.tools.qvm_check.main(['--running', '--all'],
|
qubesadmin.tools.qvm_check.main(['--running', '--all'],
|
||||||
@ -131,8 +131,8 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Running\n' \
|
b'some-vm2 class=AppVM state=Running\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm3', 'admin.vm.List', None, None)] = \
|
('some-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm3 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qubesadmin.tools.qvm_check.main(['--running', 'some-vm3'],
|
qubesadmin.tools.qvm_check.main(['--running', 'some-vm3'],
|
||||||
@ -148,8 +148,8 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Paused\n' \
|
b'some-vm2 class=AppVM state=Paused\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm2', 'admin.vm.List', None, None)] = \
|
('some-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm2 class=AppVM state=Paused\n'
|
b'0\x00power_state=Paused'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qubesadmin.tools.qvm_check.main(['--paused', 'some-vm2'],
|
qubesadmin.tools.qvm_check.main(['--paused', 'some-vm2'],
|
||||||
@ -164,11 +164,11 @@ class TC_00_qvm_check(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm2 class=AppVM state=Paused\n' \
|
b'some-vm2 class=AppVM state=Paused\n' \
|
||||||
b'some-vm3 class=AppVM state=Halted\n'
|
b'some-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm2', 'admin.vm.List', None, None)] = \
|
('some-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm2 class=AppVM state=Paused\n'
|
b'0\x00power_state=Paused'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
with self.assertLogs() as logger:
|
with self.assertLogs() as logger:
|
||||||
self.assertEqual(qubesadmin.tools.qvm_check.main(
|
self.assertEqual(qubesadmin.tools.qvm_check.main(
|
||||||
['--paused', 'some-vm2', 'some-vm'], app=self.app), 3)
|
['--paused', 'some-vm2', 'some-vm'], app=self.app), 3)
|
||||||
|
@ -270,14 +270,14 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase):
|
|||||||
b'template1 class=TemplateVM state=Halted\n' \
|
b'template1 class=TemplateVM state=Halted\n' \
|
||||||
b'sys-net class=AppVM state=Running\n'
|
b'sys-net class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('vm1', 'admin.vm.List', None, None)] = \
|
('vm1', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00vm1 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00sys-net class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('template1', 'admin.vm.List', None, None)] = \
|
('template1', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00template1 class=TemplateVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
props = {
|
props = {
|
||||||
'label': b'type=label green',
|
'label': b'type=label green',
|
||||||
'template': b'type=vm template1',
|
'template': b'type=vm template1',
|
||||||
@ -322,11 +322,11 @@ class TC_90_List_with_qubesd_calls(qubesadmin.tests.QubesTestCase):
|
|||||||
b'template1 class=TemplateVM state=Halted\n' \
|
b'template1 class=TemplateVM state=Halted\n' \
|
||||||
b'sys-net class=AppVM state=Running\n'
|
b'sys-net class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('vm1', 'admin.vm.List', None, None)] = \
|
('vm1', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00vm1 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00sys-net class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
props = {
|
props = {
|
||||||
'label': b'type=label green',
|
'label': b'type=label green',
|
||||||
'template': b'type=vm template1',
|
'template': b'type=vm template1',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -69,14 +69,14 @@ class TC_00_qvm_run(qubesadmin.tests.QubesTestCase):
|
|||||||
b'test-vm2 class=AppVM state=Running\n' \
|
b'test-vm2 class=AppVM state=Running\n' \
|
||||||
b'test-vm3 class=AppVM state=Halted\n'
|
b'test-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm2', 'admin.vm.List', None, None)] = \
|
('test-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm2 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm3', 'admin.vm.List', None, None)] = \
|
('test-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm3 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'os', None)] = \
|
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'os', None)] = \
|
||||||
b'2\x00QubesFeatureNotFoundError\x00\x00Feature \'os\' not set\x00'
|
b'2\x00QubesFeatureNotFoundError\x00\x00Feature \'os\' not set\x00'
|
||||||
@ -445,11 +445,11 @@ class TC_00_qvm_run(qubesadmin.tests.QubesTestCase):
|
|||||||
b'test-vm2 class=AppVM state=Running\n' \
|
b'test-vm2 class=AppVM state=Running\n' \
|
||||||
b'test-vm3 class=AppVM state=Halted\n'
|
b'test-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm3', 'admin.vm.List', None, None)] = \
|
('test-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm3 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'os', None)] = \
|
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'os', None)] = \
|
||||||
b'2\x00QubesFeatureNotFoundError\x00\x00Feature \'os\' not set\x00'
|
b'2\x00QubesFeatureNotFoundError\x00\x00Feature \'os\' not set\x00'
|
||||||
@ -474,8 +474,8 @@ class TC_00_qvm_run(qubesadmin.tests.QubesTestCase):
|
|||||||
b'test-vm2 class=AppVM state=Running\n' \
|
b'test-vm2 class=AppVM state=Running\n' \
|
||||||
b'test-vm3 class=AppVM state=Halted\n'
|
b'test-vm3 class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm3', 'admin.vm.List', None, None)] = \
|
('test-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm3 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
ret = qubesadmin.tools.qvm_run.main(
|
ret = qubesadmin.tools.qvm_run.main(
|
||||||
['--no-gui', '--no-autostart', 'test-vm3', 'command'],
|
['--no-gui', '--no-autostart', 'test-vm3', 'command'],
|
||||||
app=self.app)
|
app=self.app)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -101,9 +101,9 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
[b'0\x00some-vm class=AppVM state=Running\n'] + \
|
[b'0\x00power_state=Running'] + \
|
||||||
[b'0\x00some-vm class=AppVM state=Halted\n']
|
[b'0\x00power_state=Halted']
|
||||||
qubesadmin.tools.qvm_shutdown.main(['--wait', 'some-vm'], app=self.app)
|
qubesadmin.tools.qvm_shutdown.main(['--wait', 'some-vm'], app=self.app)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
@ -141,14 +141,14 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm class=AppVM state=Running\n' \
|
b'some-vm class=AppVM state=Running\n' \
|
||||||
b'other-vm class=AppVM state=Running\n'
|
b'other-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('other-vm', 'admin.vm.List', None, None)] = \
|
('other-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00other-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00sys-net class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
@ -189,14 +189,14 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm class=AppVM state=Running\n' \
|
b'some-vm class=AppVM state=Running\n' \
|
||||||
b'other-vm class=AppVM state=Running\n'
|
b'other-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('other-vm', 'admin.vm.List', None, None)] = \
|
('other-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00other-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00sys-net class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
@ -222,20 +222,20 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm class=AppVM state=Running\n' \
|
b'some-vm class=AppVM state=Running\n' \
|
||||||
b'other-vm class=AppVM state=Running\n'
|
b'other-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
[b'0\x00some-vm class=AppVM state=Running\n',
|
[b'0\x00power_state=Running',
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n',
|
b'0\x00power_state=Halted',
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n']
|
b'0\x00power_state=Halted']
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('other-vm', 'admin.vm.List', None, None)] = \
|
('other-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
[b'0\x00other-vm class=AppVM state=Running\n',
|
[b'0\x00power_state=Running',
|
||||||
b'0\x00other-vm class=AppVM state=Halted\n',
|
b'0\x00power_state=Halted',
|
||||||
b'0\x00other-vm class=AppVM state=Halted\n']
|
b'0\x00power_state=Halted']
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
[b'0\x00sys-net class=AppVM state=Running\n',
|
[b'0\x00power_state=Running',
|
||||||
b'0\x00sys-net class=AppVM state=Halted\n',
|
b'0\x00power_state=Halted',
|
||||||
b'0\x00sys-net class=AppVM state=Halted\n']
|
b'0\x00power_state=Halted']
|
||||||
with unittest.mock.patch('qubesadmin.tools.qvm_shutdown.have_events',
|
with unittest.mock.patch('qubesadmin.tools.qvm_shutdown.have_events',
|
||||||
False):
|
False):
|
||||||
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
qubesadmin.tools.qvm_shutdown.main(['--wait', '--all'], app=self.app)
|
||||||
@ -282,17 +282,17 @@ class TC_00_qvm_shutdown(qubesadmin.tests.QubesTestCase):
|
|||||||
b'some-vm class=AppVM state=Running\n' \
|
b'some-vm class=AppVM state=Running\n' \
|
||||||
b'other-vm class=AppVM state=Running\n'
|
b'other-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = [
|
('some-vm', 'admin.vm.CurrentState', None, None)] = [
|
||||||
b'0\x00some-vm class=AppVM state=Running\n',
|
b'0\x00power_state=Running',
|
||||||
]
|
]
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('other-vm', 'admin.vm.List', None, None)] = [
|
('other-vm', 'admin.vm.CurrentState', None, None)] = [
|
||||||
b'0\x00other-vm class=AppVM state=Running\n',
|
b'0\x00power_state=Running',
|
||||||
b'0\x00other-vm class=AppVM state=Running\n',
|
b'0\x00power_state=Running',
|
||||||
]
|
]
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('sys-net', 'admin.vm.List', None, None)] = \
|
('sys-net', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00sys-net class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
qubesadmin.tools.qvm_shutdown.main(
|
qubesadmin.tools.qvm_shutdown.main(
|
||||||
['--wait', '--all', '--timeout=1'], app=self.app)
|
['--wait', '--all', '--timeout=1'], app=self.app)
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -33,8 +33,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.Start', None, None)] = b'0\x00'
|
('some-vm', 'admin.vm.Start', None, None)] = b'0\x00'
|
||||||
qubesadmin.tools.qvm_start.main(['some-vm'], app=self.app)
|
qubesadmin.tools.qvm_start.main(['some-vm'], app=self.app)
|
||||||
@ -63,8 +63,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Running\n'
|
b'0\x00some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Runnin\n'
|
b'0\x00power_state=Runnin'
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qubesadmin.tools.qvm_start.main(['some-vm'], app=self.app),
|
qubesadmin.tools.qvm_start.main(['some-vm'], app=self.app),
|
||||||
1)
|
1)
|
||||||
@ -76,8 +76,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'0\x00dom0 class=AdminVM state=Running\n' \
|
b'0\x00dom0 class=AdminVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
||||||
b'0\x00sr0\n'
|
b'0\x00sr0\n'
|
||||||
@ -99,8 +99,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'0\x00dom0 class=AdminVM state=Running\n' \
|
b'0\x00dom0 class=AdminVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
||||||
b'0\x00sdb1\n'
|
b'0\x00sdb1\n'
|
||||||
@ -122,8 +122,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'0\x00dom0 class=AdminVM state=Running\n' \
|
b'0\x00dom0 class=AdminVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
||||||
b'0\x00sdb1\n'
|
b'0\x00sdb1\n'
|
||||||
@ -146,8 +146,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'0\x00dom0 class=AdminVM state=Running\n' \
|
b'0\x00dom0 class=AdminVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
('dom0', 'admin.vm.device.block.Available', None, None)] = \
|
||||||
b'0\x00loop12\n'
|
b'0\x00loop12\n'
|
||||||
@ -175,8 +175,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'other-vm class=AppVM state=Running\n' \
|
b'other-vm class=AppVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('other-vm', 'admin.vm.device.block.Available', None, None)] = \
|
('other-vm', 'admin.vm.device.block.Available', None, None)] = \
|
||||||
b'0\x00loop7\n'
|
b'0\x00loop7\n'
|
||||||
@ -208,8 +208,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'other-vm class=AppVM state=Running\n' \
|
b'other-vm class=AppVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.device.block.Attach', 'other-vm+loop7',
|
('some-vm', 'admin.vm.device.block.Attach', 'other-vm+loop7',
|
||||||
b'devtype=cdrom persistent=True read-only=True')] = b'0\x00'
|
b'devtype=cdrom persistent=True read-only=True')] = b'0\x00'
|
||||||
@ -232,8 +232,8 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
|||||||
b'other-vm class=AppVM state=Running\n' \
|
b'other-vm class=AppVM state=Running\n' \
|
||||||
b'some-vm class=AppVM state=Running\n'
|
b'some-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.List', None, None)] = \
|
('some-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00some-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('some-vm', 'admin.vm.device.block.Attach', 'other-vm+loop7',
|
('some-vm', 'admin.vm.device.block.Attach', 'other-vm+loop7',
|
||||||
b'devtype=cdrom persistent=True read-only=True')] = \
|
b'devtype=cdrom persistent=True read-only=True')] = \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -184,8 +184,8 @@ class TC_00_qvm_start_gui(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00test-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
||||||
b'0\x00default=False type=int 3000'
|
b'0\x00default=False type=int 3000'
|
||||||
@ -215,8 +215,8 @@ class TC_00_qvm_start_gui(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00test-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
||||||
b'0\x00default=False type=int 3000'
|
b'0\x00default=False type=int 3000'
|
||||||
@ -251,8 +251,8 @@ class TC_00_qvm_start_gui(qubesadmin.tests.QubesTestCase):
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00test-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
||||||
b'0\x00default=False type=int 3000'
|
b'0\x00default=False type=int 3000'
|
||||||
@ -377,8 +377,8 @@ class TC_00_qvm_start_gui(qubesadmin.tests.QubesTestCase):
|
|||||||
b'0\x00test-vm class=AppVM state=Running\n' \
|
b'0\x00test-vm class=AppVM state=Running\n' \
|
||||||
b'gui-vm class=AppVM state=Running'
|
b'gui-vm class=AppVM state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'gui', None)] = \
|
('test-vm', 'admin.vm.feature.CheckWithTemplate', 'gui', None)] = \
|
||||||
b'0\x00True'
|
b'0\x00True'
|
||||||
@ -506,8 +506,8 @@ HDMI1 connected 2560x1920+0+0 (normal left inverted right x axis y axis) 206mm x
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00test-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
||||||
'no-monitor-layout', None)] = \
|
'no-monitor-layout', None)] = \
|
||||||
@ -562,8 +562,8 @@ HDMI1 connected 2560x1920+0+0 (normal left inverted right x axis y axis) 206mm x
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Halted\n'
|
b'0\x00test-vm class=AppVM state=Halted\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
||||||
'no-monitor-layout', None)] = \
|
'no-monitor-layout', None)] = \
|
||||||
@ -591,8 +591,8 @@ HDMI1 connected 2560x1920+0+0 (normal left inverted right x axis y axis) 206mm x
|
|||||||
('dom0', 'admin.vm.List', None, None)] = \
|
('dom0', 'admin.vm.List', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00test-vm class=AppVM state=Running\n'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
('test-vm', 'admin.vm.property.Get', 'xid', None)] = \
|
||||||
b'0\x00default=False type=int 123'
|
b'0\x00default=False type=int 123'
|
||||||
@ -642,17 +642,17 @@ HDMI1 connected 2560x1920+0+0 (normal left inverted right x axis y axis) 206mm x
|
|||||||
b'test-vm4 class=AppVM state=Halted\n' \
|
b'test-vm4 class=AppVM state=Halted\n' \
|
||||||
b'gui-vm class=AppVM state=Running'
|
b'gui-vm class=AppVM state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.List', None, None)] = \
|
('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm2', 'admin.vm.List', None, None)] = \
|
('test-vm2', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm2 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm3', 'admin.vm.List', None, None)] = \
|
('test-vm3', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm3 class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm4', 'admin.vm.List', None, None)] = \
|
('test-vm4', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm4 class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
('test-vm', 'admin.vm.feature.CheckWithTemplate',
|
||||||
'gui', None)] = \
|
'gui', None)] = \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The Qubes OS Project, http://www.qubes-os.org
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
#
|
#
|
||||||
@ -213,32 +213,32 @@ class TC_01_SpecialCases(qubesadmin.tests.vm.VMTestCase):
|
|||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
|
||||||
def test_010_power_state_running(self):
|
def test_010_power_state_running(self):
|
||||||
self.app.expected_calls[('test-vm', 'admin.vm.List', None, None)] = \
|
self.app.expected_calls[('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Running\n'
|
b'0\x00power_state=Running'
|
||||||
self.assertEqual(self.vm.get_power_state(), 'Running')
|
self.assertEqual(self.vm.get_power_state(), 'Running')
|
||||||
self.assertTrue(self.vm.is_running())
|
self.assertTrue(self.vm.is_running())
|
||||||
self.assertFalse(self.vm.is_halted())
|
self.assertFalse(self.vm.is_halted())
|
||||||
self.assertFalse(self.vm.is_paused())
|
self.assertFalse(self.vm.is_paused())
|
||||||
|
|
||||||
def test_011_power_state_paused(self):
|
def test_011_power_state_paused(self):
|
||||||
self.app.expected_calls[('test-vm', 'admin.vm.List', None, None)] = \
|
self.app.expected_calls[('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Paused\n'
|
b'0\x00power_state=Paused'
|
||||||
self.assertEqual(self.vm.get_power_state(), 'Paused')
|
self.assertEqual(self.vm.get_power_state(), 'Paused')
|
||||||
self.assertTrue(self.vm.is_running())
|
self.assertTrue(self.vm.is_running())
|
||||||
self.assertFalse(self.vm.is_halted())
|
self.assertFalse(self.vm.is_halted())
|
||||||
self.assertTrue(self.vm.is_paused())
|
self.assertTrue(self.vm.is_paused())
|
||||||
|
|
||||||
def test_012_power_state_halted(self):
|
def test_012_power_state_halted(self):
|
||||||
self.app.expected_calls[('test-vm', 'admin.vm.List', None, None)] = \
|
self.app.expected_calls[('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Halted\n'
|
b'0\x00power_state=Halted'
|
||||||
self.assertEqual(self.vm.get_power_state(), 'Halted')
|
self.assertEqual(self.vm.get_power_state(), 'Halted')
|
||||||
self.assertFalse(self.vm.is_running())
|
self.assertFalse(self.vm.is_running())
|
||||||
self.assertTrue(self.vm.is_halted())
|
self.assertTrue(self.vm.is_halted())
|
||||||
self.assertFalse(self.vm.is_paused())
|
self.assertFalse(self.vm.is_paused())
|
||||||
|
|
||||||
def test_012_power_state_transient(self):
|
def test_012_power_state_transient(self):
|
||||||
self.app.expected_calls[('test-vm', 'admin.vm.List', None, None)] = \
|
self.app.expected_calls[('test-vm', 'admin.vm.CurrentState', None, None)] = \
|
||||||
b'0\x00test-vm class=AppVM state=Transient\n'
|
b'0\x00power_state=Transient'
|
||||||
self.assertEqual(self.vm.get_power_state(), 'Transient')
|
self.assertEqual(self.vm.get_power_state(), 'Transient')
|
||||||
self.assertTrue(self.vm.is_running())
|
self.assertTrue(self.vm.is_running())
|
||||||
self.assertFalse(self.vm.is_halted())
|
self.assertFalse(self.vm.is_halted())
|
||||||
|
Loading…
Reference in New Issue
Block a user