예제 #1
0
    def test_service_which_has_dependencies_delete(self):
        resp, _content = utils.create_service(
            self.test_service, str(self.auth_token))
        resp, _content = utils.create_role_mapped_to_service(
            self.test_service + ":test_role",
            self.auth_token, self.test_service)
        self.assertEqual(201, int(resp['status']))
        resp, _content = utils.create_role_ref(
            self.user, self.test_service +
            ":test_role", self.tenant, self.auth_token)
        self.assertEqual(201, int(resp['status']))
        resp, _content = utils.create_endpoint_template(\
            'DFW', self.test_service, 'public_url',\
            'admin_url', 'internal_url', True, False, self.auth_token)
        self.assertEqual(201, int(resp['status']))

        #verify content
        obj = json.loads(_content)
        if not "endpointTemplate" in obj:
            raise fault.BadRequestFault("Expecting endpointTemplate")
        endpoint_template = obj["endpointTemplate"]
        if not "id" in endpoint_template:
            endpoint_template_id = None
        else:
            endpoint_template_id = endpoint_template["id"]
        resp, _content = utils.create_endpoint_xml(self.tenant,
            endpoint_template_id,
            str(self.auth_token))
        resp_val = int(resp['status'])
        self.assertEqual(201, resp_val)

        resp, _content = utils.delete_service(
            self.test_service, self.auth_token)
        resp_val = int(resp['status'])
        self.assertEqual(204, resp_val)
예제 #2
0
 def test_create_endpoint_template(self):
     resp, content = utils.create_endpoint_template(\
         self.region, self.service, self.public_url,\
         self.admin_url, self.internal_url,\
         self.enabled, self.is_global, self.auth_token)
     self.assertEqual(201, int(resp['status']))
     obj = json.loads(content)
     if not "endpointTemplate" in obj:
         raise fault.BadRequestFault("Expecting endpointTemplate")
     endpoint_template = obj["endpointTemplate"]
     if not "id" in endpoint_template:
         endpoint_template_id = None
     else:
         endpoint_template_id = endpoint_template["id"]
     if endpoint_template_id == None:
         self.fail("Not the expected Endpoint Template")
     if not "serviceId" in endpoint_template:
         service_id = None
     else:
         service_id = endpoint_template["serviceId"]
     if service_id != utils.get_test_service_id():
         self.fail("Not the expected service")
     resp, content = utils.delete_endpoint_template(
         endpoint_template_id, self.auth_token)
     self.assertEqual(204, int(resp['status']))
예제 #3
0
 def test_create_and_delete_endpoint_template_that_has_dependencies(self):
     resp, content = utils.create_endpoint_template(\
         self.region, self.service, self.public_url,\
         self.admin_url, self.internal_url,\
         self.enabled, self.is_global, self.auth_token)
     self.assertEqual(201, int(resp['status']))
     obj = json.loads(content)
     if not "endpointTemplate" in obj:
         raise fault.BadRequestFault("Expecting endpointTemplate")
     endpoint_template = obj["endpointTemplate"]
     if not "id" in endpoint_template:
         endpoint_template_id = None
     else:
         endpoint_template_id = endpoint_template["id"]
     if endpoint_template_id == None:
         self.fail("Not the expected Endpoint Template")
     resp, _content = utils.create_endpoint_xml(self.tenant,
         endpoint_template_id,
         str(self.auth_token))
     resp_val = int(resp['status'])
     self.assertEqual(201, resp_val)
     resp, content = utils.delete_endpoint_template(
         endpoint_template_id, self.auth_token)
     self.assertEqual(204, int(resp['status']))
예제 #4
0
 def setUp(self):
     self.tenant = utils.get_tenant()
     self.password = utils.get_password()
     self.email = utils.get_email()
     self.user = utils.get_user()
     self.userdisabled = utils.get_userdisabled()
     self.auth_token = utils.get_auth_token()
     self.service_token = utils.get_service_token()
     self.exp_auth_token = utils.get_exp_auth_token()
     self.disabled_token = utils.get_disabled_token()
     self.missing_token = utils.get_none_token()
     self.invalid_token = utils.get_non_existing_token()
     utils.create_tenant(self.tenant, str(self.auth_token))
     utils.create_user(self.tenant, self.user, self.auth_token)
     self.token = utils.get_token(self.user, 'secrete', self.tenant,
                                  'token')
     self.region = 'DFW'
     self.service = utils.get_test_service_id()
     self.public_url = 'public'
     self.admin_url = 'admin'
     self.internal_url = 'internal'
     self.enabled = True
     self.is_global = False
     resp, content = utils.create_endpoint_template(\
         self.region, self.service, self.public_url,\
         self.admin_url, self.internal_url,\
         self.enabled, self.is_global, self.auth_token)
     self.assertEqual(201, int(resp['status']))
     obj = json.loads(content)
     if not "endpointTemplate" in obj:
         raise fault.BadRequestFault("Expecting endpointTemplate")
     endpoint_template = obj["endpointTemplate"]
     if not "id" in endpoint_template:
         self.endpoint_template_id = None
     else:
         self.endpoint_template_id = endpoint_template["id"]