def setUp(self) -> None: self.app = create_app(config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() mock_elasticsearch_client = MagicMock() self.es_proxy = ElasticsearchProxy(client=mock_elasticsearch_client) self.mock_badge = Tag(tag_name='name') self.mock_tag = Tag(tag_name='match') self.mock_empty_badge = [] # type: List[Tag] self.mock_empty_tag = [] # type: List[Tag] self.mock_result1 = MockSearchResult(name='test_table', resource_type='table', key='test_key', description='test_description', cluster='gold', database='test_db', schema='test_schema', column_names=['test_col1', 'test_col2'], tags=self.mock_empty_tag, badges=self.mock_empty_badge, last_updated_timestamp=1527283287, programmatic_descriptions=[]) self.mock_result2 = MockSearchResult(name='test_table2', resource_type='table', key='test_key2', description='test_description2', cluster='gold', database='test_db2', schema='test_schema2', column_names=['test_col1', 'test_col2'], tags=self.mock_empty_tag, badges=self.mock_empty_badge, last_updated_timestamp=1527283287) self.mock_result3 = Table(id='test_key3', name='test_table3', key='test_key3', description='test_description3', cluster='gold', database='test_db3', schema='test_schema3', column_names=['test_col1', 'test_col2'], tags=[self.mock_tag], badges=[self.mock_badge], last_updated_timestamp=1527283287) self.mock_result4 = MockUserSearchResult(full_name='First Last', first_name='First', last_name='Last', team_name='Test team', email='*****@*****.**', github_username='******', manager_email='*****@*****.**', is_active=True, employee_type='FTE', role_name='swe', new_attr='aaa', resource_type='user', )
def setUp(self) -> None: self.app = create_app(config_module_class='search_service.config.Config') self.app_context = self.app.app_context() self.app_context.push() self.mock_client = patch('search_service.api.table.get_proxy_client') self.mock_proxy = self.mock_client.start().return_value = Mock()
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() mock_elasticsearch_client = MagicMock() self.es_proxy = ElasticsearchProxy(client=mock_elasticsearch_client)
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() mock_elasticsearch_client = MagicMock() self.es_proxy = ElasticsearchProxy(client=mock_elasticsearch_client) self.mock_result1 = MockSearchResult( name='test_table', key='test_key', description='test_description', cluster='gold', database='test_db', schema_name='test_schema', column_names=['test_col1', 'test_col2'], tags=[], last_updated_epoch=1527283287) self.mock_result2 = MockSearchResult( name='test_table2', key='test_key2', description='test_description2', cluster='gold', database='test_db2', schema_name='test_schema2', column_names=['test_col1', 'test_col2'], tags=[], last_updated_epoch=1527283287) self.mock_result3 = Table(name='test_table3', key='test_key3', description='test_description3', cluster='gold', database='test_db3', schema_name='test_schema3', column_names=['test_col1', 'test_col2'], tags=['match'], last_updated_epoch=1527283287) self.mock_result4 = MockKVSearchResult( name='First Last', first_name='First', last_name='Last', team_name='Test team', email='*****@*****.**', github_username='******', manager_email='*****@*****.**', is_active=True, employee_type='FTE', new_attr='aaa')
def setUp(self) -> None: self.app = create_app(config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() self.mock_index = 'table_search_index' self.mock_term = 'test' self.mock_page_index = 0 self.mock_search_request = { 'type': 'AND', 'filters': { 'database': ['db1', 'db2'] } } self.url = '/search_table'
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() self.mock_index = 'dashboard_search_index' self.mock_term = 'test' self.mock_page_index = 0 self.mock_search_request = { 'type': 'AND', 'filters': { 'product': ['mode'] } } self.url = '/search_dashboard_filter'
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() mock_elasticsearch_client = MagicMock() self.es_proxy = ElasticsearchProxy( elasticsearch_client=mock_elasticsearch_client) self.mock_result1 = MockSearchResult( table_name='test_table', table_key='test_key', table_description='test_description', cluster='gold', database='test_db', schema_name='test_schema', column_names=['test_col1', 'test_col2'], tag_names=[], table_last_updated_epoch=1527283287) self.mock_result2 = MockSearchResult( table_name='test_table2', table_key='test_key2', table_description='test_description2', cluster='gold', database='test_db2', schema_name='test_schema2', column_names=['test_col1', 'test_col2'], tag_names=[], table_last_updated_epoch=1527283287) self.mock_result3 = Table(name='test_table3', key='test_key3', description='test_description3', cluster='gold', database='test_db3', schema_name='test_schema3', column_names=['test_col1', 'test_col2'], tags=['match'], last_updated_epoch=1527283287)
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.Config') self.app_context = self.app.app_context() self.app_context.push()
def setUp(self) -> None: self.app = create_app( config_module_class='search_service.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() self.qn = False with self.app_context: from search_service.proxy.atlas import AtlasProxy self.proxy = AtlasProxy(host='DOES_NOT_MATTER:0000') self.proxy.atlas = MagicMock() self.qn = 'name' == "qualifiedName" self.entity_type = 'TEST_ENTITY' self.cluster = 'TEST_CLUSTER' self.db = 'TEST_DB' self.name = 'TEST_TABLE' self.table_uri = f'{self.entity_type}://{self.cluster}.{self.db}/{self.name}' self.classification_entity = { 'classifications': [ { 'typeName': 'PII_DATA', 'name': 'PII_DATA' }, ] } self.test_column = { 'guid': 'DOESNT_MATTER', 'typeName': 'COLUMN', 'attributes': { 'qualifiedName': f"{self.db}.Table1.column@{self.cluster}", 'type': 'Managed', 'description': 'column description', 'position': 1 } } self.db_entity = { 'guid': '-100', 'typeName': self.entity_type, 'attributes': { 'qualifiedName': self.db + "@" + self.cluster, 'name': self.db, 'clusterName': self.cluster } } self.entity1_name = 'Table1' self.entity1_description = 'Dummy Description' self.entity1 = { 'guid': '1', 'typeName': self.entity_type, 'classificationNames': ['PII_DATA'], 'relationshipAttributes': { 'db': self.db_entity }, 'attributes': { 'updateTime': 123, 'name': self.entity1_name, 'qualifiedName': f"{self.db}.Table1@{self.cluster}", 'classifications': [{ 'typeName': 'PII_DATA' }], 'description': self.entity1_description, 'owner': '*****@*****.**', 'columns': [self.test_column], 'db': self.db_entity }, 'classifications': self.classification_entity['classifications'] } self.entity2_name = 'Table2' self.entity2 = { 'guid': '2', 'typeName': self.entity_type, 'classificationNames': [], 'attributes': { 'updateTime': 234, 'qualifiedName': 'Table2', 'name': self.entity2_name, 'db': None, 'description': 'Dummy Description', 'owner': '*****@*****.**', }, 'classifications': self.classification_entity['classifications'] } self.entities = { 'entities': [ self.entity1, self.entity2, ], }
from search_service import create_app app = create_app(config_module_class='configs.config.SearchConfig') if __name__ == '__main__': app.run(host='0.0.0.0', port=5001)
import os from search_service import create_app """ Entry Point to Flask. """ config_module_class = (os.getenv('SEARCH_SVC_CONFIG_MODULE_CLASS') or 'search_service.config.LocalConfig') application = create_app(config_module_class=config_module_class) if __name__ == "__main__": application.run(host='0.0.0.0', port=5001)