本文整理匯總了Python中shiji.testutil.DummyRequest.args["arg1"]方法的典型用法代碼示例。如果您正苦於以下問題:Python DummyRequest.args["arg1"]方法的具體用法?Python DummyRequest.args["arg1"]怎麽用?Python DummyRequest.args["arg1"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類shiji.testutil.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.args["arg1"]方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_good_page_overrides_default
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_good_page_overrides_default(self):
"Valid page argument overrides page from default."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["1"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page"][0], "1")
示例2: test_json_validate_success
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_json_validate_success(self):
"Request URL arguments successfully validated."
test_request = DummyRequest()
test_request.setHeader("Content-Type", "application/json; charset=utf-8")
test_request.args["arg1"] = "test"
res = self.dummy_render_func2(test_request)
self.assertEqual(res, "okey dokey")
示例3: test_page_len_gt_max_page_len_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_page_len_gt_max_page_len_fail(self):
"page_len argument in request is > max_page_len."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page_len"] = ["501"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page_len", "Argument must be 500 or less.")))
示例4: test_page_lt_zero_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_page_lt_zero_fail(self):
"page argument in request is < 0."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["-1"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page", "Argument must be 0 or greater.")))
示例5: test_page_invalid_int_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_page_invalid_int_fail(self):
"page argument in request is not a valid integer."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["xyz"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page", "Argument must be an integer.")))
示例6: test_good_page_and_page_len_overrides_default
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_good_page_and_page_len_overrides_default(self):
"Valid page & page_len arguments override page & page_len from defaults."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["1"]
test_request.args["page_len"] = ["50"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page"][0], "1")
self.assertEqual(res["page_len"][0], "50")
示例7: test_no_page_uses_default
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["arg1"] [as 別名]
def test_no_page_uses_default(self):
"No page argument sets page to default."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page"][0], "0")