'Tests that the OGC_Servers_Handler throws an ImproperlyConfigured exception when using the importer
backend without a vector database and a datastore configured.'

def test_importer_configuration(self):

    database_settings = self.DATABASE_DEFAULT_SETTINGS.copy()
    ogc_server_settings = self.OGC_DEFAULT_SETTINGS.copy()
    uploader_settings = self.UPLOADER_DEFAULT_SETTINGS.copy()
    uploader_settings['BACKEND'] = 'geonode.importer'
    self.assertTrue([('geonode_imports' not in database_settings.keys())])
    with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
        with self.assertRaises(ImproperlyConfigured):
            OGC_Servers_Handler(ogc_server_settings)['default']
    ogc_server_settings['default']['DATASTORE'] = 'geonode_imports'
    with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
        with self.assertRaises(ImproperlyConfigured):
            OGC_Servers_Handler(ogc_server_settings)['default']
    database_settings['geonode_imports'] = database_settings['default'].copy()
    database_settings['geonode_imports'].update({'NAME': 'geonode_imports'})
    with self.settings(UPLOADER=uploader_settings, OGC_SERVER=ogc_server_settings, DATABASES=database_settings):
        OGC_Servers_Handler(ogc_server_settings)['default']
