本文整理汇总了Python中morepath.app.App.mounted方法的典型用法代码示例。如果您正苦于以下问题:Python App.mounted方法的具体用法?Python App.mounted怎么用?Python App.mounted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类morepath.app.App
的用法示例。
在下文中一共展示了App.mounted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_notfound
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_notfound():
config = setup()
app = App(testing_config=config)
config.commit()
response = publish(app.request(get_environ(path='')), app.mounted())
assert response.status == '404 NOT FOUND'
示例2: test_notfound
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_notfound():
app = App()
c = setup()
c.configurable(app)
c.commit()
response = publish(app.request(get_environ(path='')), app.mounted())
assert response.status == '404 NOT FOUND'
示例3: test_notfound
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_notfound():
config = setup()
app = App(testing_config=config)
config.commit()
request = app.request(get_environ(path=''))
request.mounts.append(app.mounted())
with pytest.raises(HTTPNotFound):
publish(request)
示例4: test_view_raises_http_error
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_view_raises_http_error():
config = setup()
app = App(testing_config=config)
config.commit()
from werkzeug.exceptions import BadRequest
def view(self, request):
raise BadRequest()
register_path(app, Model, 'foo', None, None, None, Model)
register_view(app, Model, view)
response = publish(app.request(get_environ(path='foo')), app.mounted())
assert response.status == '400 BAD REQUEST'
示例5: test_view_raises_http_error
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_view_raises_http_error():
config = setup()
app = App(testing_config=config)
config.commit()
def view(self, request):
raise HTTPBadRequest()
register_path(app, Model, 'foo', None, None, None, None, Model)
register_view(app, Model, view)
request = app.request(get_environ(path='foo'))
request.mounts.append(app.mounted())
with pytest.raises(HTTPBadRequest):
publish(request)
示例6: test_view_raises_http_error
# 需要导入模块: from morepath.app import App [as 别名]
# 或者: from morepath.app.App import mounted [as 别名]
def test_view_raises_http_error():
app = App()
c = setup()
c.configurable(app)
c.commit()
from werkzeug.exceptions import BadRequest
def view(request, model):
raise BadRequest()
register_model(app, Model, 'foo', None, Model)
register_view(app, Model, view)
response = publish(app.request(get_environ(path='foo')), app.mounted())
assert response.status == '400 BAD REQUEST'