1
0

test_lxd_image.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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("lxd_image.absent", name="images:centos/7",)
  26. name = "lxd_image_|-images:centos/7_|-images:centos/7_|-absent"
  27. self.assertSaltTrueReturn(ret)
  28. assert name in ret
  29. assert (
  30. ret[name]["changes"]["removed"]
  31. == 'Image "images:centos/7" has been deleted.'
  32. )