__init__.py 1.9 KB

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