本文整理匯總了Python中shiji.testutil.DummyRequest.uri方法的典型用法代碼示例。如果您正苦於以下問題:Python DummyRequest.uri方法的具體用法?Python DummyRequest.uri怎麽用?Python DummyRequest.uri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類shiji.testutil.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.uri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_post
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import uri [as 別名]
def test_post(self):
"Test unknown API call return error code & message via POST"
request = DummyRequest(api_mode="", api_version="", api_name="")
request.setHeader("X-DigiTar-API-Version", "dummyapi")
request.uri = "dummy.com/dummyapi/call"
resource = urldispatch.UnknownCall()
body = resource.render_POST(request)
self.assertEquals(request.response_code, 404)
self.assertEquals(request.getHeader("Content-Type"),
"application/json; charset=utf-8")
self.assertEquals(body, str(webapi.UnknownAPICallError(request,
"call")))
示例2: test_match
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import uri [as 別名]
def test_match(self):
request = DummyRequest(api_mode="", api_version="", api_name="")
request.uri = "/example/"
res = self.url_router.getChild("noname", request)
self.assertTrue(isinstance(res, calls.PingCall))
示例3: test_no_match
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import uri [as 別名]
def test_no_match(self):
request = DummyRequest(api_mode="", api_version="", api_name="")
request.uri = "/notexample/"
res = self.url_router.getChild("noname", request)
self.assertTrue(isinstance(res, urldispatch.UnknownAPI))