test_dimensiondata.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # -*- coding: utf-8 -*-
  2. """
  3. Integration tests for the Dimension Data cloud provider
  4. """
  5. # Import Python Libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt Testing Libs
  8. from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
  9. class DimensionDataTest(CloudTest):
  10. """
  11. Integration tests for the Dimension Data cloud provider in Salt-Cloud
  12. """
  13. PROVIDER = "dimensiondata"
  14. REQUIRED_PROVIDER_CONFIG_ITEMS = ("key", "region", "user_id")
  15. def test_list_images(self):
  16. """
  17. Tests the return of running the --list-images command for the dimensiondata cloud provider
  18. """
  19. image_list = self.run_cloud("--list-images {0}".format(self.PROVIDER))
  20. self.assertIn("Ubuntu 14.04 2 CPU", [i.strip() for i in image_list])
  21. def test_list_locations(self):
  22. """
  23. Tests the return of running the --list-locations command for the dimensiondata cloud provider
  24. """
  25. _list_locations = self.run_cloud("--list-locations {0}".format(self.PROVIDER))
  26. self.assertIn(
  27. "Australia - Melbourne MCP2", [i.strip() for i in _list_locations]
  28. )
  29. def test_list_sizes(self):
  30. """
  31. Tests the return of running the --list-sizes command for the dimensiondata cloud provider
  32. """
  33. _list_sizes = self.run_cloud("--list-sizes {0}".format(self.PROVIDER))
  34. self.assertIn("default", [i.strip() for i in _list_sizes])
  35. def test_instance(self):
  36. """
  37. Test creating an instance on Dimension Data's cloud
  38. """
  39. # check if instance with salt installed returned
  40. ret_val = self.run_cloud(
  41. "-p dimensiondata-test {0}".format(self.instance_name), timeout=TIMEOUT
  42. )
  43. self.assertInstanceExists(ret_val)
  44. self.assertDestroyInstance()