def test_create_dataset_multiple_values(self): dataset_name = u'dataset-esd-2' app = self._get_test_app() # Recreate tables command = ESDCommand('esd') command.load(assume_yes=True) env, response = _get_package_new_page(app) form = response.forms[1] form['name'] = dataset_name form['la_function'] = u'Youth offending,Education and learning' form[ 'la_service'] = u'Abandoned bicycles, Passenger transport vehicle licence' response = submit_and_follow(app, form, env, 'save') form = response.forms[1] form['url'] = u'http://example.com/resource' submit_and_follow(app, form, env, 'save', 'go-metadata') dataset_dict = helpers.call_action('package_show', id=dataset_name) assert_equals(dataset_dict['name'], dataset_name) assert_equals( dataset_dict['la_function'], 'http://id.esd.org.uk/function/22 http://id.esd.org.uk/function/23' ) assert_equals( dataset_dict['la_service'], 'http://id.esd.org.uk/service/1512 http://id.esd.org.uk/service/1513' )
def test_create_dataset_uris(self): dataset_name = u'dataset-esd-3' app = self._get_test_app() # Recreate tables command = ESDCommand('esd') command.load(assume_yes=True) env, response = _get_package_new_page(app) form = response.forms[1] form['name'] = dataset_name form[ 'la_function'] = 'http://id.esd.org.uk/function/22 http://id.esd.org.uk/function/23' form[ 'la_service'] = 'http://id.esd.org.uk/service/1512 http://id.esd.org.uk/service/1513' response = submit_and_follow(app, form, env, 'save') form = response.forms[1] form['url'] = u'http://example.com/resource' submit_and_follow(app, form, env, 'save', 'go-metadata') dataset_dict = helpers.call_action('package_show', id=dataset_name) assert_equals(dataset_dict['name'], dataset_name) assert_equals( dataset_dict['la_function'], 'http://id.esd.org.uk/function/22 http://id.esd.org.uk/function/23' ) assert_equals( dataset_dict['la_service'], 'http://id.esd.org.uk/service/1512 http://id.esd.org.uk/service/1513' )
def test_initdb(self): command = ESDCommand('esd') command.initdb() assert esd_function_table.exists() assert esd_service_table.exists()
def test_load_data(self): command = ESDCommand('esd') command.load(assume_yes=True) assert esd_function_table.exists() assert esd_service_table.exists() row_count_functions, row_count_services = _num_rows_in_csv_files() assert_equals( model.Session.execute(esd_function_table.count()).scalar(), row_count_functions) assert_equals( model.Session.execute(esd_service_table.count()).scalar(), row_count_services)
def setup_class(cls): command = ESDCommand('esd') command.load(assume_yes=True)