def test_get_services_using_invalid_tokens(self): resp, content = utils.get_services(self.disabled_token) self.assertEqual(403, int(resp['status'])) resp, content = utils.get_services(self.missing_token) self.assertEqual(401, int(resp['status'])) resp, content = utils.get_services(self.exp_auth_token) self.assertEqual(403, int(resp['status'])) resp, content = utils.get_services(self.invalid_token) self.assertEqual(404, int(resp['status']))
def test_get_services_exp_token(self): resp, content = utils.get_services(self.exp_auth_token) if int(resp['status']) == 500: self.fail('Identity Fault') elif int(resp['status']) == 503: self.fail('Service Not Available') self.assertEqual(403, int(resp['status']))
def test_get_services_using_service_admin_token(self): resp, content = utils.get_services(self.service_token) self.assertEqual(200, int(resp['status'])) #verify content obj = json.loads(content) if not "services" in obj: raise self.fail("Expecting Services") services = obj["services"]["values"] if len(services) < 1: self.fail("Services not of required length.") is_service_found = None for service in services: if service["id"] in [self.sample_service]: is_service_found = True if not is_service_found: raise self.fail("Service not found")