1
0

test_lxd_image.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Integration tests for the lxd states
  4. '''
  5. # Import Python Libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Lxd Test Case
  8. import tests.integration.states.test_lxd
  9. class LxdImageTestCase(tests.integration.states.test_lxd.LxdTestCase):
  10. def test_02__pull_image(self):
  11. ret = self.run_state(
  12. 'lxd_image.present',
  13. name='images:centos/7',
  14. source={
  15. 'name': 'centos/7',
  16. 'type': 'simplestreams',
  17. 'server': 'https://images.linuxcontainers.org',
  18. },
  19. )
  20. name = 'lxd_image_|-images:centos/7_|-images:centos/7_|-present'
  21. self.assertSaltTrueReturn(ret)
  22. assert name in ret
  23. assert ret[name]['changes']['aliases'] == ['Added alias "images:centos/7"']
  24. def test_03__delete_image(self):
  25. ret = self.run_state(
  26. 'lxd_image.absent',
  27. name='images:centos/7',
  28. )
  29. name = 'lxd_image_|-images:centos/7_|-images:centos/7_|-absent'
  30. self.assertSaltTrueReturn(ret)
  31. assert name in ret
  32. assert ret[name]['changes']['removed'] == 'Image "images:centos/7" has been deleted.'