示例#1
0
 def setUp(self):
     self.tenant = utils.get_tenant()
     self.token = utils.get_token(
         'joeuser', 'secrete', self.tenant, 'token')
     self.userdisabled = utils.get_userdisabled()
     self.auth_token = utils.get_auth_token()
     utils.delete_all_endpoint(self.tenant, self.auth_token)
     utils.create_endpoint(self.tenant, "1", str(self.auth_token))
     utils.create_endpoint(self.tenant, "2", str(self.auth_token))
     utils.create_endpoint(self.tenant, "3", str(self.auth_token))
     utils.create_endpoint(self.tenant, "4", str(self.auth_token))
示例#2
0
 def test_endpoint_create_using_service_admin_token(self):
     _header = httplib2.Http(".cache")
     resp, _content = utils.create_endpoint(self.tenant, "1",
         str(self.service_token))
     resp_val = int(resp['status'])
     self.assertEqual(201, resp_val)
     resp, _content = utils.delete_endpoint(
         self.tenant, '1', self.service_token)
     resp_val = int(resp['status'])
     self.assertEqual(204, resp_val)
示例#3
0
 def test_delete_endpoint_using_invalid_auth_token(self):
     header = httplib2.Http(".cache")
     resp, content = utils.create_endpoint(self.tenant, "1",
         str(self.auth_token))
     resp_val = int(resp['status'])
     self.assertEqual(201, resp_val)
     obj = json.loads(content)
     if not "endpoint" in obj:
         raise fault.BadRequestFault("Expecting endpoint")
     endpoint = obj["endpoint"]
     if not "id" in endpoint:
         endpoint_id = None
     else:
         endpoint_id = endpoint["id"]
     if endpoint_id is None:
         raise fault.BadRequestFault("Expecting endpoint ID")
     url = '%stenants/%s/endpoints/%s' % (URL_V2, self.tenant, endpoint_id)
     resp, content = header.request(url, "DELETE", body='', headers={
         "Content-Type": "application/json",
         "X-Auth-Token": str(self.invalid_token)})
     resp_val = int(resp['status'])
     self.assertEqual(404, resp_val)
示例#4
0
 def test_endpoint_create_json_using_invalid_token(self):
     _header = httplib2.Http(".cache")
     resp, _content = utils.create_endpoint(self.tenant, "1",
         str(self.invalid_token))
     resp_val = int(resp['status'])
     self.assertEqual(404, resp_val)