actions.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- encoding: utf8 -*-
  2. #
  3. # The Qubes OS Project, http://www.qubes-os.org
  4. #
  5. # Copyright (C) 2017 Marek Marczykowski-Górecki
  6. # <marmarek@invisiblethingslab.com>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU Lesser General Public License as published by
  10. # the Free Software Foundation; either version 2.1 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Lesser General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Lesser General Public License along
  19. # with this program; if not, see <http://www.gnu.org/licenses/>.
  20. import unittest
  21. import qubesadmin.tests.vm
  22. class TC_00_Actions(qubesadmin.tests.vm.VMTestCase):
  23. def test_000_start(self):
  24. self.app.expected_calls[
  25. ('test-vm', 'mgmt.vm.Start', None, None)] = \
  26. b'0\x00'
  27. self.vm.start()
  28. self.assertAllCalled()
  29. def test_001_shutdown(self):
  30. self.app.expected_calls[
  31. ('test-vm', 'mgmt.vm.Shutdown', None, None)] = \
  32. b'0\x00'
  33. self.vm.shutdown()
  34. self.assertAllCalled()
  35. def test_002_kill(self):
  36. self.app.expected_calls[
  37. ('test-vm', 'mgmt.vm.Kill', None, None)] = \
  38. b'0\x00'
  39. self.vm.kill()
  40. self.assertAllCalled()
  41. def test_003_pause(self):
  42. self.app.expected_calls[
  43. ('test-vm', 'mgmt.vm.Pause', None, None)] = \
  44. b'0\x00'
  45. self.vm.pause()
  46. self.assertAllCalled()
  47. def test_004_unpause(self):
  48. self.app.expected_calls[
  49. ('test-vm', 'mgmt.vm.Unpause', None, None)] = \
  50. b'0\x00'
  51. self.vm.unpause()
  52. self.assertAllCalled()
  53. @unittest.skip('Not part of the mgmt API yet')
  54. def test_005_suspend(self):
  55. self.app.expected_calls[
  56. ('test-vm', 'mgmt.vm.Suspend', None, None)] = \
  57. b'0\x00'
  58. self.vm.suspend()
  59. self.assertAllCalled()
  60. @unittest.skip('Not part of the mgmt API yet')
  61. def test_006_resume(self):
  62. self.app.expected_calls[
  63. ('test-vm', 'mgmt.vm.Resume', None, None)] = \
  64. b'0\x00'
  65. self.vm.resume()
  66. self.assertAllCalled()