本文整理汇总了Python中morepath.config.Config.scan方法的典型用法代码示例。如果您正苦于以下问题:Python Config.scan方法的具体用法?Python Config.scan怎么用?Python Config.scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类morepath.config.Config
的用法示例。
在下文中一共展示了Config.scan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_basic_json
# 需要导入模块: from morepath.config import Config [as 别名]
# 或者: from morepath.config.Config import scan [as 别名]
def test_basic_json():
setup()
basic.app.clear()
config = Config()
config.scan(basic)
config.commit()
c = Client(basic.app, Response)
response = c.get('/foo/json')
assert response.data == '{"id": "foo"}'
示例2: test_basic
# 需要导入模块: from morepath.config import Config [as 别名]
# 或者: from morepath.config.Config import scan [as 别名]
def test_basic():
setup()
basic.app.clear()
config = Config()
config.scan(basic)
config.commit()
c = Client(basic.app, Response)
response = c.get('/foo')
assert response.data == 'The view for model: foo'
response = c.get('/foo/link')
assert response.data == 'foo'
示例3: test_nested
# 需要导入模块: from morepath.config import Config [as 别名]
# 或者: from morepath.config.Config import scan [as 别名]
def test_nested():
setup()
nested.outer_app.clear()
nested.app.clear()
config = Config()
config.scan(nested)
config.commit()
c = Client(nested.outer_app, Response)
response = c.get('/inner/foo')
assert response.data == 'The view for model: foo'
response = c.get('/inner/foo/link')
assert response.data == 'inner/foo'
示例4: test_basic_root
# 需要导入模块: from morepath.config import Config [as 别名]
# 或者: from morepath.config.Config import scan [as 别名]
def test_basic_root():
setup()
basic.app.clear()
config = Config()
config.scan(basic)
config.commit()
c = Client(basic.app, Response)
response = c.get('/')
assert response.data == 'The root: ROOT'
# @@ is to make sure we get the view, not the sub-model
response = c.get('/@@link')
assert response.data == ''