当前位置: 首页>>代码示例>>Python>>正文


Python Config.scan方法代码示例

本文整理汇总了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"}'
开发者ID:kingel,项目名称:morepath,代码行数:15,代码来源:test_directive.py

示例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'
开发者ID:kingel,项目名称:morepath,代码行数:18,代码来源:test_directive.py

示例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'
开发者ID:kingel,项目名称:morepath,代码行数:19,代码来源:test_directive.py

示例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 == ''
开发者ID:kingel,项目名称:morepath,代码行数:19,代码来源:test_directive.py


注:本文中的morepath.config.Config.scan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。