def test_hmac_config_file(self): _file = "config_hmac.ini" config = config_from_file(os.path.join(TEST_ROOT, _file)) auth = auth_from_config(config) self.assertEqual(type(auth), HMACAuth) client = client_from_config_file(os.path.join(TEST_ROOT, _file)) self.assertEqual(type(client.http_client.auth_strategy), HMACAuth)
def test_no_config_with_mode(self): config = config_from_file(os.path.join(TEST_ROOT, "config_blank.ini"), mode="prod") auth = auth_from_config(config) self.assertEqual(config["url"], default_url(mode="prod")) self.assertEqual(auth, None) client = client_from_config_file(path=os.path.join(TEST_ROOT, "config_blank.ini")) self.assertEqual(client.http_client.auth_strategy, None)
def test_no_config_with_mode(self): config = config_from_file(os.path.join(TEST_ROOT, "config_blank.ini"), mode="prod") auth = auth_from_config(config) self.assertEqual(config["url"], default_url(mode="prod")) self.assertEqual(auth, None) client = client_from_config_file( path=os.path.join(TEST_ROOT, "config_blank.ini")) self.assertEqual(client.http_client.auth_strategy, None)
def test_srs_config_file_none(self): config = config_from_file(os.path.join(TEST_ROOT, "config_srs.ini"), "dev") print(config) auth = auth_from_config(config) self.assertEqual(auth, None)
def test_srs_config_file(self): config = config_from_file(os.path.join(TEST_ROOT, "config_srs.ini")) auth = auth_from_config(config) self.assertEqual(type(auth), HMACAuthSRS)
import os, sys from datacat import client_from_config, config_from_file from datacat.model import Metadata # datacat config_file ='./config_srs.ini' config = config_from_file(config_file) client = client_from_config(config) # file/datacatalog path file_path = os.path.abspath("../../../test/data/") def main(): # Will generate 2 datasets, in this case we are only using 1 of the generated 2 created_datasets = create_datasets() dataset001 = created_datasets[0] # ***************************************************** # ***************************************************** # ******* GROUP DEPENDENCY CREATION BEGINS HERE ******* # ***************************************************** # ***************************************************** # adding the datasets with their dependentType to a groups metadata (predecessor) metadata = Metadata() dep_metadataPredecessor = { "dependents": str(dataset001.versionPk), "dependentType": "predecessor" }