def test_ocp_infrastructure_type_error(self): """Test that the provider infrastructure returns Unknown when running stand alone.""" provider_authentication = ProviderAuthentication.objects.create( provider_resource_name='cluster_id_1001') provider = Provider.objects.create( name='ocpprovidername', type=Provider.PROVIDER_OCP, created_by=self.user, customer=self.customer, authentication=provider_authentication, ) data_generator = OCPAWSReportDataGenerator(self.tenant, provider, current_month_only=True) data_generator.create_ocp_provider('cool-cluster-id', 'awesome-alias') provider_uuid = data_generator.provider_uuid manager = ProviderManager(provider_uuid) with patch.object(ProviderAccessor, 'infrastructure_type', side_effect=ProviderAccessorError('mock_error')): infrastructure_name = manager.get_infrastructure_name(self.tenant) self.assertEqual(infrastructure_name, 'Unknown-Error') data_generator.remove_data_from_tenant()
def test_ocp_infrastructure_type_error(self): """Test that the provider infrastructure returns Unknown when running stand alone.""" data_generator = OCPAWSReportDataGenerator(self.tenant, current_month_only=True) data_generator.create_ocp_provider('cool-cluster-id', 'awesome-alias') provider_uuid = data_generator.provider_uuid manager = ProviderManager(provider_uuid) with patch.object(ProviderAccessor, 'infrastructure_type', side_effect=ProviderAccessorError('mock_error')): infrastructure_name = manager.get_infrastructure_name(self.tenant) self.assertEqual(infrastructure_name, 'Unknown-Error') data_generator.remove_data_from_tenant()