本文整理汇总了Python中twisted.web.test.test_web.DummyRequest.path方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.path方法的具体用法?Python DummyRequest.path怎么用?Python DummyRequest.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.test.test_web.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_handles_defaults_correctly
# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import path [as 别名]
def test_handles_defaults_correctly():
u2m = {}
u2m["/doesn/t/exist"] = root.__default__
u2m["/sub/doesn/t/exist"] = root.sub.__default__
for path, method in u2m.items():
request = DummyRequest([])
request.path = path
action = site.routeRequest(request)
assert getattr(action, "func", None) == method, "Expecting %s but got %s for URL %s" % (method, action, path)
示例2: test_handles_defaults_correctly
# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import path [as 别名]
def test_handles_defaults_correctly():
u2m = {}
site = make_new_graph()
root = site.resource
u2m['/doesn/t/exist'] = root.__default__
u2m['/sub/doesn/t/exist'] = root.sub.__default__
for path, method in u2m.items():
request = DummyRequest([])
request.path = path
action = site.routeRequest(request)
assert isinstance(action, NoResource)
示例3: test_invalid_blob_id_put
# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import path [as 别名]
def test_invalid_blob_id_put(self):
request = DummyRequest(['valid-user', 'invalid blob id'])
request.path = '/blobs/'
with pytest.raises(Exception):
self.resource.render_PUT(request)
示例4: test_invalid_user_get
# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import path [as 别名]
def test_invalid_user_get(self):
request = DummyRequest(['invalid user', 'valid-blob-id'])
request.path = '/blobs/'
with pytest.raises(Exception):
self.resource.render_GET(request)