本文整理汇总了Python中nevow.testutil.FakeRequest.args方法的典型用法代码示例。如果您正苦于以下问题:Python FakeRequest.args方法的具体用法?Python FakeRequest.args怎么用?Python FakeRequest.args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nevow.testutil.FakeRequest
的用法示例。
在下文中一共展示了FakeRequest.args方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_domainSpecified
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import args [as 别名]
def test_domainSpecified(self):
"""
Test that L{usernameFromRequest} returns the username in the request
if that username specifies a domain.
"""
request = FakeRequest(headers={"host": "divmod.com"})
request.args = {"username": ["[email protected]"]}
username = usernameFromRequest(request)
self.assertEqual(username, "[email protected]")
示例2: test_domainUnspecified
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import args [as 别名]
def test_domainUnspecified(self):
"""
Test that L{usernameFromRequest} adds the value of host header to the
username in the request if the username doesn't already specify a
domain.
"""
request = FakeRequest(headers={"host": "divmod.com"})
request.args = {"username": ["joe"]}
username = usernameFromRequest(request)
self.assertEqual(username, "[email protected]")
示例3: test_rendering
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import args [as 别名]
def test_rendering(self):
"""
L{AddBlogPostDialogFragment} can be rendered as part of a Mantissa
public Athena page.
"""
page = PublicAthenaLivePage(self.store, self.fragment, None, None)
request = FakeRequest()
request.args = {'title': ['foo'],
'body': ['bar'],
'url': ['baz']}
return renderLivePage(page, reqFactory=lambda: request)
示例4: process
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import args [as 别名]
def process(typed, data, configurable=None, ctx=None):
if ctx is None:
from nevow.testutil import FakeRequest
from nevow import context
fr = FakeRequest()
if type(data) is dict:
fr.args = data
ctx = context.RequestContext(tag=fr)
ctx.remember(fr, inevow.IRequest)
ctx.remember(None, inevow.IData)
try:
return iformless.IInputProcessor(typed).process(ctx, configurable, data, autoConfigure=False)
except TypeError:
return iformless.IInputProcessor(typed).process(ctx, configurable, data)