def test_populate_table_with_defaults_and_dictize(self): # Register NGDS configs with pylons global config app_globals.mappings['ngds.publish'] = 'ngds.publish' app_globals.mappings['ngds.harvest'] = 'ngds.harvest' app_globals.mappings['ngds.edit_metadata'] = 'ngds.edit_metadata' # Make dictionary of configs with default values to initialize the # 'ngds_system_info' table data = { 'ngds.publish': config.get('ngds.publish', 'True'), 'ngds.harvest': config.get('ngds.harvest', 'True'), 'ngds.edit_metadata': config.get('ngds.edit_metadata', 'True'), } # Populate that sucka db.init_table_populate(model, data) # Hocus pocus magic to make sure that the 'ngds_system_info' table was # populated with the correct values db_config = {} table = db.SysadminConfig.get(active_config=True) mapped_table = orm.class_mapper(table.__class__).mapped_table for key in mapped_table.c.keys(): db_config[key] = getattr(table, key) assert db_config.get('ngds.publish') == 'True' assert db_config.get('ngds.harvest') == 'True' assert db_config.get('ngds.edit_metadata') == 'True'
def ngds_aggregator_url(): ngds_aggregator_url = config.get('ngds.aggregator_url', 'http://www.geothermaldata.org') return ngds_aggregator_url