def test_register_provider_class_double(self): # Attempting to register the same class twice should register second # instance class DummyClass(CloudProvider): PROVIDER_ID = 'aws' factory = CloudProviderFactory() factory.list_providers() factory.register_provider_class(DummyClass) self.assertTrue(DummyClass in factory.get_all_provider_classes()) self.assertTrue( AWSCloudProvider not in factory.get_all_provider_classes())
def test_register_mock_provider_class_double(self): # Attempting to register the same mock provider twice should register # only the second instance class DummyClass(CloudProvider, TestMockHelperMixin): PROVIDER_ID = 'aws' factory = CloudProviderFactory() factory.list_providers() factory.register_provider_class(DummyClass) self.assertTrue(DummyClass in factory.get_all_provider_classes( get_mock=True)) self.assertTrue( MockAWSCloudProvider not in factory.get_all_provider_classes( get_mock=True))
def test_register_mock_provider_class_double(self): """ Attempting to register the same mock provider twice should register only the second instance """ class DummyClass(CloudProvider, TestMockHelperMixin): PROVIDER_ID = 'aws' factory = CloudProviderFactory() factory.list_providers() factory.register_provider_class(DummyClass) self.assertTrue(DummyClass in factory.get_all_provider_classes(get_mock=True)) self.assertTrue(MockAWSCloudProvider not in factory.get_all_provider_classes(get_mock=True))
def test_register_provider_class_double(self): """ Attempting to register the same class twice should register second instance """ class DummyClass(CloudProvider): PROVIDER_ID = 'aws' factory = CloudProviderFactory() factory.list_providers() factory.register_provider_class(DummyClass) self.assertTrue(DummyClass in factory.get_all_provider_classes(get_mock=False)) self.assertTrue(AWSCloudProvider not in factory.get_all_provider_classes(get_mock=False))