__init__.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/python2 -O
  2. # vim: fileencoding=utf-8
  3. # pylint: disable=protected-access,pointless-statement
  4. #
  5. # The Qubes OS Project, https://www.qubes-os.org/
  6. #
  7. # Copyright (C) 2015 Joanna Rutkowska <joanna@invisiblethingslab.com>
  8. # Copyright (C) 2015 Wojtek Porczyk <woju@invisiblethingslab.com>
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License along
  21. # with this program; if not, write to the Free Software Foundation, Inc.,
  22. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. #
  24. import qubes.tests
  25. class TestVMM(object):
  26. # pylint: disable=too-few-public-methods
  27. def __init__(self, offline_mode=False):
  28. self.offline_mode = offline_mode
  29. @property
  30. def libvirt_conn(self):
  31. import libvirt
  32. raise libvirt.libvirtError('phony error')
  33. class TestHost(object):
  34. # pylint: disable=too-few-public-methods
  35. def __init__(self):
  36. self.memory_total = 1000 * 1024
  37. self.no_cpus = 4
  38. class TestApp(qubes.tests.TestEmitter):
  39. labels = {1: qubes.Label(1, '0xcc0000', 'red')}
  40. check_updates_vm = False
  41. def get_label(self, label):
  42. # pylint: disable=unused-argument
  43. if label in self.labels:
  44. return self.labels[label]
  45. for l in self.labels.values():
  46. if l.name == label:
  47. return l
  48. raise KeyError(label)
  49. def __init__(self):
  50. super(TestApp, self).__init__()
  51. self.vmm = TestVMM()
  52. self.host = TestHost()
  53. self.pools = {}