2017-02-25 01:47:13 +01:00
|
|
|
# -*- encoding: utf8 -*-
|
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2017 Marek Marczykowski-Górecki
|
|
|
|
# <marmarek@invisiblethingslab.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import unittest
|
|
|
|
|
2017-05-11 23:21:04 +02:00
|
|
|
import qubesadmin.tests.vm
|
2017-02-25 01:47:13 +01:00
|
|
|
|
|
|
|
|
2017-05-11 23:21:04 +02:00
|
|
|
class TC_00_Actions(qubesadmin.tests.vm.VMTestCase):
|
2017-02-25 01:47:13 +01:00
|
|
|
def test_000_start(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Start', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.start()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_001_shutdown(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Shutdown', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.shutdown()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_002_kill(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Kill', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.kill()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_003_pause(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Pause', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.pause()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
def test_004_unpause(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Unpause', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.unpause()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
@unittest.skip('Not part of the mgmt API yet')
|
|
|
|
def test_005_suspend(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Suspend', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.suspend()
|
|
|
|
self.assertAllCalled()
|
|
|
|
|
|
|
|
@unittest.skip('Not part of the mgmt API yet')
|
|
|
|
def test_006_resume(self):
|
|
|
|
self.app.expected_calls[
|
2017-05-12 19:36:03 +02:00
|
|
|
('test-vm', 'admin.vm.Resume', None, None)] = \
|
2017-02-25 01:47:13 +01:00
|
|
|
b'0\x00'
|
|
|
|
self.vm.resume()
|
|
|
|
self.assertAllCalled()
|