本文整理匯總了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 == ''