|
|
@@ -16,28 +16,22 @@ class CloudFactoryTestCase(unittest.TestCase):
|
|
|
_multiprocess_can_split_ = True
|
|
|
|
|
|
def test_create_provider_valid(self):
|
|
|
- """
|
|
|
- Creating a provider with a known name should return
|
|
|
- a valid implementation
|
|
|
- """
|
|
|
+ # Creating a provider with a known name should return
|
|
|
+ # a valid implementation
|
|
|
self.assertIsInstance(CloudProviderFactory().create_provider(
|
|
|
factory.ProviderList.AWS, {}),
|
|
|
interfaces.CloudProvider,
|
|
|
"create_provider did not return a valid VM type")
|
|
|
|
|
|
def test_create_provider_invalid(self):
|
|
|
- """
|
|
|
- Creating a provider with an invalid name should raise a
|
|
|
- NotImplementedError
|
|
|
- """
|
|
|
+ # Creating a provider with an invalid name should raise a
|
|
|
+ # NotImplementedError
|
|
|
with self.assertRaises(NotImplementedError):
|
|
|
CloudProviderFactory().create_provider("ec23", {})
|
|
|
|
|
|
def test_find_provider_mock_valid(self):
|
|
|
- """
|
|
|
- Searching for a provider with a known mock driver should return
|
|
|
- an implementation implementing helpers.TestMockHelperMixin
|
|
|
- """
|
|
|
+ # Searching for a provider with a known mock driver should return
|
|
|
+ # an implementation implementing helpers.TestMockHelperMixin
|
|
|
mock = CloudProviderFactory().get_provider_class(
|
|
|
factory.ProviderList.AWS, get_mock=True)
|
|
|
self.assertTrue(
|
|
|
@@ -55,24 +49,18 @@ class CloudFactoryTestCase(unittest.TestCase):
|
|
|
cls)
|
|
|
|
|
|
def test_get_provider_class_valid(self):
|
|
|
- """
|
|
|
- Searching for a provider class with a known name should return a valid
|
|
|
- class
|
|
|
- """
|
|
|
+ # Searching for a provider class with a known name should return a
|
|
|
+ # valid class
|
|
|
self.assertEqual(CloudProviderFactory().get_provider_class(
|
|
|
factory.ProviderList.AWS), AWSCloudProvider)
|
|
|
|
|
|
def test_get_provider_class_invalid(self):
|
|
|
- """
|
|
|
- Searching for a provider class with an invalid name should
|
|
|
- return None
|
|
|
- """
|
|
|
+ # Searching for a provider class with an invalid name should
|
|
|
+ # return None
|
|
|
self.assertIsNone(CloudProviderFactory().get_provider_class("aws1"))
|
|
|
|
|
|
def test_register_provider_class_invalid(self):
|
|
|
- """
|
|
|
- Attempting to register an invalid test class should be ignored
|
|
|
- """
|
|
|
+ # Attempting to register an invalid test class should be ignored
|
|
|
class DummyClass(object):
|
|
|
PROVIDER_ID = 'aws'
|
|
|
|
|
|
@@ -82,10 +70,8 @@ class CloudFactoryTestCase(unittest.TestCase):
|
|
|
factory.get_all_provider_classes(get_mock=False))
|
|
|
|
|
|
def test_register_provider_class_double(self):
|
|
|
- """
|
|
|
- Attempting to register the same class twice should register second
|
|
|
- instance
|
|
|
- """
|
|
|
+ # Attempting to register the same class twice should register second
|
|
|
+ # instance
|
|
|
class DummyClass(CloudProvider):
|
|
|
PROVIDER_ID = 'aws'
|
|
|
|
|
|
@@ -98,10 +84,8 @@ class CloudFactoryTestCase(unittest.TestCase):
|
|
|
factory.get_all_provider_classes(get_mock=False))
|
|
|
|
|
|
def test_register_mock_provider_class_double(self):
|
|
|
- """
|
|
|
- Attempting to register the same mock provider twice should register
|
|
|
- only the second instance
|
|
|
- """
|
|
|
+ # Attempting to register the same mock provider twice should register
|
|
|
+ # only the second instance
|
|
|
class DummyClass(CloudProvider, TestMockHelperMixin):
|
|
|
PROVIDER_ID = 'aws'
|
|
|
|
|
|
@@ -114,10 +98,8 @@ class CloudFactoryTestCase(unittest.TestCase):
|
|
|
factory.get_all_provider_classes(get_mock=True))
|
|
|
|
|
|
def test_register_provider_class_without_id(self):
|
|
|
- """
|
|
|
- Attempting to register a class without a PROVIDER_ID attribute
|
|
|
- should be ignored.
|
|
|
- """
|
|
|
+ # Attempting to register a class without a PROVIDER_ID attribute
|
|
|
+ # should be ignored.
|
|
|
class DummyClass(CloudProvider):
|
|
|
pass
|
|
|
|