def setup_class(cls): engine = db.get_write_engine() cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine)) datastore_test_helpers.clear_db(cls.Session) create_tables = [ u'CREATE TABLE test_a (id_a text)', u'CREATE TABLE test_b (id_b text)', u'CREATE TABLE "TEST_C" (id_c text)', u'CREATE TABLE test_d ("α/α" integer)', ] for create_table_sql in create_tables: cls.Session.execute(create_table_sql)
def setup_class(cls): if not pylons.config.get('ckan.datastore.read_url'): raise nose.SkipTest('Datastore runs on legacy mode, skipping...') engine = db._get_engine( {'connection_url': pylons.config['ckan.datastore.write_url']}) cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine)) datastore_test_helpers.clear_db(cls.Session) create_tables = [ 'CREATE TABLE test_a (id_a text)', 'CREATE TABLE test_b (id_b text)', 'CREATE TABLE "TEST_C" (id_c text)', ] for create_table_sql in create_tables: cls.Session.execute(create_table_sql)
def setup_class(cls): if not config.get('ckan.datastore.read_url'): raise nose.SkipTest('Datastore runs on legacy mode, skipping...') engine = db.get_write_engine() cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine)) datastore_test_helpers.clear_db(cls.Session) create_tables = [ u'CREATE TABLE test_a (id_a text)', u'CREATE TABLE test_b (id_b text)', u'CREATE TABLE "TEST_C" (id_c text)', u'CREATE TABLE test_d ("α/α" integer)', ] for create_table_sql in create_tables: cls.Session.execute(create_table_sql)
def reset_datastore_db(): engine = get_write_engine() Session = orm.scoped_session(orm.sessionmaker(bind=engine)) datastore_helpers.clear_db(Session)
def teardown_class(cls): datastore_test_helpers.clear_db(cls.Session)