def print_storage(self): """ Simply query for storage accessible by this group and print it. Backend supplies storage from the parent group(s) too. """ storage_response = storage.get_drivers(self.base_url, self.group_id, self.token) storage_dict = common.convert_response(storage_response) # response contains a field called 'drivers' drivers = storage_dict['drivers'] for d in drivers: # Each driver has a mount, describing how the storage resource is mounted in Athera sessions mount = d['mounts'][0] self.indented_print("{} storage mounted at {} with ID: {}".format(d['name'], mount['mountLocation'], d['id']), 1)
def test_get_drivers(self): """ Positive test - Get drivers of the user, the provided group_id and the group's ancestors """ response = storage.get_drivers( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, self.token, ) self.assertEqual(response.status_code, codes.ok) data = response.json() drivers = data['drivers'] self.assertNotEqual(len(drivers), 0) first_driver = drivers[0] mounts = first_driver["mounts"] self.assertNotEqual(len(mounts), 0)
def check_dropbox_connected(logger, base_url, group_id, token): """ Get all the user and group storage available for the supplied context (dictated by group_id). Iterate through the storage paths looking for a 'Dropbox' type. """ storage_response = storage.get_drivers(base_url, group_id, token) storage_dict = common.convert_response(storage_response) # response contains a field called 'drivers' drivers = storage_dict['drivers'] dropbox = None for d in drivers: logger.info("Driver: {:50} {}".format(d['name'], d['id'])) if d['type'] == "Dropbox": dropbox = d return dropbox