def setUp(self) -> None: self.app = create_app( config_module_class='metadata_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push()
def setUp(self) -> None: self.app = create_app( config_module_class='metadata_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() table_entry = { 'db': { 'name': 'hive' }, 'clstr': { 'name': 'gold' }, 'schema': { 'name': 'foo_schema' }, 'tbl': { 'name': 'foo_table' }, 'tbl_dscrpt': { 'description': 'foo description' } } col1 = copy.deepcopy(table_entry) # type: Dict[Any, Any] col1['col'] = {'name': 'bar_id_1', 'type': 'varchar', 'sort_order': 0} col1['col_dscrpt'] = {'description': 'bar col description'} col1['col_stats'] = [{ 'stat_name': 'avg', 'start_epoch': 1, 'end_epoch': 1, 'stat_val': '1' }] col1['col_badges'] = [] col2 = copy.deepcopy(table_entry) # type: Dict[Any, Any] col2['col'] = {'name': 'bar_id_2', 'type': 'bigint', 'sort_order': 1} col2['col_dscrpt'] = {'description': 'bar col2 description'} col2['col_stats'] = [{ 'stat_name': 'avg', 'start_epoch': 2, 'end_epoch': 2, 'stat_val': '2' }] col2['col_badges'] = [{'key': 'primary key', 'category': 'column'}] table_level_results = MagicMock() table_level_results.single.return_value = { 'wmk_records': [{ 'key': 'hive://gold.test_schema/test_table/high_watermark/', 'partition_key': 'ds', 'partition_value': 'fake_value', 'create_time': 'fake_time', }, { 'key': 'hive://gold.test_schema/test_table/low_watermark/', 'partition_key': 'ds', 'partition_value': 'fake_value', 'create_time': 'fake_time', }], 'application': { 'application_url': 'airflow_host/admin/airflow/tree?dag_id=test_table', 'description': 'DAG generating a table', 'name': 'Airflow', 'id': 'dag/task_id' }, 'last_updated_timestamp': 1, 'owner_records': [{ 'key': '*****@*****.**', 'email': '*****@*****.**' }], 'tag_records': [{ 'key': 'test', 'tag_type': 'default' }], 'badge_records': [{ 'key': 'golden', 'category': 'table_status' }], 'src': { 'source': '/source_file_loc', 'key': 'some key', 'source_type': 'github' }, 'prog_descriptions': [{ 'description_source': 's3_crawler', 'description': 'Test Test Test' }, { 'description_source': 'quality_report', 'description': 'Test Test' }] } table_writer = { 'application_url': 'airflow_host/admin/airflow/tree?dag_id=test_table', 'description': 'DAG generating a table', 'name': 'Airflow', 'id': 'dag/task_id' } last_updated_timestamp = '01' self.col_usage_return_value = [col1, col2] self.table_level_return_value = table_level_results self.table_writer = table_writer self.last_updated_timestamp = last_updated_timestamp