def get_driver_indexing_status(self, driver_id): response = storage.get_driver( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, self.token, driver_id, ) self.assertEqual(response.status_code, codes.ok) data = response.json() self.assertEqual(data["type"], "GCS") # This is only guaranteed if using GROUP_DRIVER statuses = data["statuses"] self.assertNotEqual(len(statuses), 0) indexing_status = statuses[0] # Getting indexing status for the first region assuming it's the one we want return indexing_status
def get_driver_indexing_status(self, driver_id): response = storage.get_driver( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, environment.ATHERA_API_TEST_TOKEN, driver_id, ) self.assertEqual(response.status_code, codes.ok) data = response.json() print(data) self.assertEqual(data["type"], "GCS") statuses = data["statuses"] self.assertNotEqual(len(statuses), 0) reindex_status = statuses[0] return reindex_status["indexingInProgress"]
def test_get_driver(self): """ Positive test -Get information on the driver """ response = storage.get_driver( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, self.token, environment.ATHERA_API_TEST_GROUP_DRIVER_ID, ) self.assertEqual(response.status_code, codes.ok) driver = response.json() self.assertEqual(driver["type"], "GCS") statuses = driver["statuses"] self.assertNotEqual(len(statuses), 0) mounts = driver["mounts"] self.assertNotEqual(len(mounts), 0) mount = mounts[0] self.assertEqual(mount["type"], "MountTypeGroup") self.assertEqual(mount["id"], environment.ATHERA_API_TEST_GROUP_MOUNT_ID) self.assertEqual(mount["mountLocation"], environment.ATHERA_API_TEST_GROUP_MOUNT_LOCATION)
def get_driver_indexing_status(self, driver_id, region=None): print("get_driver_indexing_status - region: {} driver_id: {}".format( region, driver_id)) response = storage.get_driver( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, self.token, driver_id, ) self.assertEqual(response.status_code, codes.ok) data = response.json() self.assertEqual( data["type"], "GCS") # This is only guaranteed if using GROUP_DRIVER statuses = data["statuses"] self.assertNotEqual(len(statuses), 0) if not region: return statuses # Return all statuses as a list for s in statuses: if s['region'] == region: return s self.fail("Requested region not found")