def setup(self): self.account_client = AccountClient() self.scope_client = ScopeClient() self.meta_client = MetaClient() self.did_client = DIDClient() self.replica_client = ReplicaClient() self.rse_client = RSEClient()
def setUp(self): if config_get_bool('common', 'multi_vo', raise_exception=False, default=False): self.vo = {'vo': config_get('client', 'vo', raise_exception=False, default='tst')} else: self.vo = {} self.account_client = AccountClient() self.scope_client = ScopeClient() self.meta_client = MetaClient() self.did_client = DIDClient() self.replica_client = ReplicaClient() self.rse_client = RSEClient()
def setUp(self): """ Setup the Test Case """ self.did_client = DIDClient() self.meta_client = MetaClient() self.rse_client = RSEClient() self.scope_client = ScopeClient()
def setUp(self): self.meta_client = MetaClient()
class TestMetaClient(unittest.TestCase): def setUp(self): self.meta_client = MetaClient() def xtest_add_and_list_keys(self): """ META (CLIENTS): Add a key and List all keys.""" key = 'key_' + str(uuid())[:20] ret = self.meta_client.add_key(key=key, key_type='ALL') assert ret keys = self.meta_client.list_keys() assert isinstance(keys, list) assert key in keys def xtest_add_and_list_values(self): """ META (CLIENTS): Add a value and List all values.""" key = 'key_' + str(uuid())[:20] value = 'value_' + str(uuid()) ret = self.meta_client.add_key(key=key, key_type='ALL') assert ret ret = self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert isinstance(values, list) assert value in values def xtest_add_value_with_type(self): """ META (CLIENTS): Add a new value to a key with a type constraint""" key = 'key_' + str(uuid())[:20] value = 'value_' + str(uuid()) self.meta_client.add_key(key=key, key_type='ALL', value_type=str) self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert value in values self.meta_client.add_value(key=key, value=1234) def xtest_add_value_with_regexp(self): """ META (CLIENTS): Add a new value to a key with a regexp constraint""" key = 'guid' + str(uuid())[:20] value = str(uuid()) # regexp for uuid regexp = '[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}' self.meta_client.add_key(key=key, key_type='ALL', value_regexp=regexp) self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert value in values with pytest.raises(InvalidValueForKey): self.meta_client.add_value(key=key, value='Nimportnawak') def xtest_add_unsupported_type(self): """ META (CLIENTS): Add an unsupported value for type """ key = 'key_' + str(uuid())[:20] with pytest.raises(UnsupportedValueType): self.meta_client.add_key(key=key, key_type='ALL', value_type=str) def xtest_add_value_to_bad_key(self): """ META (CLIENTS): Add a new value to a non existing key """ value = 'value_' + str(uuid()) with pytest.raises(KeyNotFound): self.meta_client.add_value(key="Nimportnawak", value=value) def test_add_key(self): """ META (CLIENTS): Add a new key """ types = [{ 'type': 'FILE', 'expected': KeyType.FILE }, { 'type': 'ALL', 'expected': KeyType.ALL }, { 'type': 'COLLECTION', 'expected': KeyType.COLLECTION }, { 'type': 'DATASET', 'expected': KeyType.DATASET }, { 'type': 'D', 'expected': KeyType.DATASET }, { 'type': 'FILE', 'expected': KeyType.FILE }, { 'type': 'F', 'expected': KeyType.FILE }, { 'type': 'DERIVED', 'expected': KeyType.DERIVED }, { 'type': 'C', 'expected': KeyType.CONTAINER }] for key_type in types: key_name = 'datatype%s' % str(uuid()) self.meta_client.add_key(key_name, key_type['type']) stored_key_type = session.get_session().query( models.DIDKey).filter_by(key=key_name).one()['key_type'] assert stored_key_type, key_type['expected'] with pytest.raises(UnsupportedKeyType): self.meta_client.add_key('datatype', 'A')
def setup(self): self.meta_client = MetaClient()
class TestMetaClient(): def setup(self): self.meta_client = MetaClient() def xtest_add_and_list_keys(self): """ META (CLIENTS): Add a key and List all keys.""" key = 'key_' + str(uuid())[:20] ret = self.meta_client.add_key(key=key, key_type='ALL') assert_true(ret) keys = self.meta_client.list_keys() assert_is_instance(keys, list) assert_in(key, keys) def xtest_add_and_list_values(self): """ META (CLIENTS): Add a value and List all values.""" key = 'key_' + str(uuid())[:20] value = 'value_' + str(uuid()) ret = self.meta_client.add_key(key=key, key_type='ALL') assert_true(ret) ret = self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert_is_instance(values, list) assert_in(value, values) @raises(InvalidValueForKey) def xtest_add_value_with_type(self): """ META (CLIENTS): Add a new value to a key with a type constraint""" key = 'key_' + str(uuid())[:20] value = 'value_' + str(uuid()) self.meta_client.add_key(key=key, key_type='ALL', value_type=unicode) self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert_in(value, values) self.meta_client.add_value(key=key, value=1234) @raises(InvalidValueForKey) def xtest_add_value_with_regexp(self): """ META (CORE): Add a new value to a key with a regexp constraint""" key = 'guid' + str(uuid())[:20] value = str(uuid()) # regexp for uuid regexp = '[a-f0-9]{8}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{4}[a-f0-9]{12}' self.meta_client.add_key(key=key, key_type='ALL', value_regexp=regexp) self.meta_client.add_value(key=key, value=value) values = self.meta_client.list_values(key=key) assert_in(value, values) self.meta_client.add_value(key=key, value='Nimportnawak') @raises(UnsupportedValueType) def xtest_add_unsupported_type(self): """ META (CLIENTS): Add an unsupported value for type """ key = 'key_' + str(uuid())[:20] self.meta_client.add_key(key=key, key_type='ALL', value_type=str) @raises(KeyNotFound) def xtest_add_value_to_bad_key(self): """ META (CLIENTS): Add a new value to a non existing key """ value = 'value_' + str(uuid()) self.meta_client.add_value(key="Nimportnawak", value=value)