test_dimensiondata.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 CloudTest, TIMEOUT
  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(
  21. 'Ubuntu 14.04 2 CPU',
  22. [i.strip() for i in image_list]
  23. )
  24. def test_list_locations(self):
  25. '''
  26. Tests the return of running the --list-locations command for the dimensiondata cloud provider
  27. '''
  28. _list_locations = self.run_cloud('--list-locations {0}'.format(self.PROVIDER))
  29. self.assertIn(
  30. 'Australia - Melbourne MCP2',
  31. [i.strip() for i in _list_locations]
  32. )
  33. def test_list_sizes(self):
  34. '''
  35. Tests the return of running the --list-sizes command for the dimensiondata cloud provider
  36. '''
  37. _list_sizes = self.run_cloud('--list-sizes {0}'.format(self.PROVIDER))
  38. self.assertIn(
  39. 'default',
  40. [i.strip() for i in _list_sizes]
  41. )
  42. def test_instance(self):
  43. '''
  44. Test creating an instance on Dimension Data's cloud
  45. '''
  46. # check if instance with salt installed returned
  47. ret_val = self.run_cloud('-p dimensiondata-test {0}'.format(self.instance_name), timeout=TIMEOUT)
  48. self.assertInstanceExists(ret_val)
  49. self.assertDestroyInstance()