本文整理汇总了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")