def test_tempate_maker_run(): with open(f'{os.getcwd()}/sample-input/load-template-google-sheets/template-abc.gsheet') \ as json_file: spreadsheet_id = json.load(json_file)['doc_id'] load_template_google_sheets.TemplateMaker().run( spreadsheet_id=spreadsheet_id, project_id=TEST_PROJECT_ID, template_id='template_abc', display_name='Testing Load Tag Templates from Google Sheets', delete_existing=True) location_name = f'projects/{TEST_PROJECT_ID}/locations/us-central1' main_template_name = f'{location_name}/tagTemplates/template_abc' multivalued_field_template_name = \ f'{location_name}/tagTemplates/template_abc_multivalued_field_xyz' datacatalog_client = datacatalog.DataCatalogClient() assert datacatalog_client.get_tag_template(name=main_template_name) assert datacatalog_client.get_tag_template( name=multivalued_field_template_name) # Clean up. datacatalog_client.delete_tag_template(name=main_template_name, force=True) datacatalog_client.delete_tag_template( name=multivalued_field_template_name, force=True)
class ExecutionResultsTest(unittest.TestCase): __datacatalog = datacatalog.DataCatalogClient() def test_entries_should_exist_after_connector_execution(self): query = 'system=qlik' scope = datacatalog.SearchCatalogRequest.Scope() scope.include_project_ids.append( os.environ['QLIK2DC_DATACATALOG_PROJECT_ID']) request = datacatalog.SearchCatalogRequest() request.scope = scope request.query = query request.page_size = 1000 search_results = [ result for result in self.__datacatalog.search_catalog(request) ] self.assertGreater(len(search_results), 0)
def test_tempate_maker_run(): load_template_csv.TemplateMaker().run( files_folder=f'{os.getcwd()}/sample-input/load-template-csv', project_id=TEST_PROJECT_ID, template_id='template_abc', display_name='Testing Load Tag Templates from CSV files', delete_existing=True) location_name = f'projects/{TEST_PROJECT_ID}/locations/us-central1' main_template_name = f'{location_name}/tagTemplates/template_abc' multivalued_field_template_name = \ f'{location_name}/tagTemplates/template_abc_multivalued_field_xyz' datacatalog_client = datacatalog.DataCatalogClient() assert datacatalog_client.get_tag_template(name=main_template_name) assert datacatalog_client.get_tag_template( name=multivalued_field_template_name) # Clean up. datacatalog_client.delete_tag_template(name=main_template_name, force=True) datacatalog_client.delete_tag_template( name=multivalued_field_template_name, force=True)
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import unittest from google.cloud import datacatalog datacatalog_client = datacatalog.DataCatalogClient() class ExecutionResultsTest(unittest.TestCase): def test_entries_should_exist_after_connector_execution(self): query = 'system=redshift' scope = datacatalog.SearchCatalogRequest.Scope() scope.include_project_ids.append( os.environ['REDSHIFT2DC_DATACATALOG_PROJECT_ID']) request = datacatalog.SearchCatalogRequest() request.scope = scope request.query = query request.page_size = 1000
def __init__(self): # Initialize the API client. self.__datacatalog = datacatalog.DataCatalogClient()
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import unittest from google.cloud import datacatalog from google.cloud.datacatalog import types datacatalog = datacatalog.DataCatalogClient() class CleanupResultsTest(unittest.TestCase): def test_tableau_entries_should_not_exist_after_cleanup(self): query = 'system=tableau' scope = types.SearchCatalogRequest.Scope() scope.include_project_ids.append( os.environ['TABLEAU2DC_DATACATALOG_PROJECT_ID']) search_results = [ result for result in datacatalog.search_catalog( scope=scope, query=query, order_by='relevance', page_size=1000) ]
def __init__(self, project_id): self.__datacatalog = datacatalog.DataCatalogClient() self.__project_id = project_id