def test_location_col_add(self): drop_if_exists(self.opera_meta.dataset_name) etl = PlenarioETL(self.opera_meta, source_path=self.opera_path) new_table = etl.add() all_rows = postgres_session.execute(new_table.select()).fetchall() self.assertEqual(len(all_rows), 5) postgres_session.close() new_table.drop(postgres_engine, checkfirst=True) # Did we add a bbox? bbox = MetaTable.get_by_dataset_name('public_opera_performances').bbox self.assertIsNotNone(bbox)
def test_new_table_has_correct_column_names_in_meta(self): drop_if_exists(self.unloaded_meta.dataset_name) etl = PlenarioETL(self.unloaded_meta, source_path=self.radio_path) new_table = etl.add() columns = postgres_session.query(MetaTable.column_names) columns = columns.filter(MetaTable.dataset_name == self.unloaded_meta.dataset_name) columns = columns.first()[0] self.assertEqual(len(columns), 4) postgres_session.close() new_table.drop(postgres_engine, checkfirst=True)
def test_new_table(self): drop_if_exists(self.unloaded_meta.dataset_name) etl = PlenarioETL(self.unloaded_meta, source_path=self.radio_path) new_table = etl.add() all_rows = postgres_session.execute(new_table.select()).fetchall() self.assertEqual(len(all_rows), 5) postgres_session.close() new_table.drop(postgres_engine, checkfirst=True) # Did we add a bbox? bbox = MetaTable.get_by_dataset_name('community_radio_events').bbox self.assertIsNotNone(bbox)
def tearDown(self): postgres_session.close()
def tearDownClass(cls): postgres_session.close()