• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_stack.app_from_config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.test_stack.app_from_config函数的典型用法代码示例。如果您正苦于以下问题:Python app_from_config函数的具体用法?Python app_from_config怎么用?Python app_from_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了app_from_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_jinja_custom_filters

def test_jinja_custom_filters():
    # Simple test filter to get a md5 hash of a string
    def codify(value):
        try:
            from hashlib import md5
        except ImportError:
            from md5 import md5
        string_hash = md5(value.encode("ascii"))
        return string_hash.hexdigest()

    base_config = TestConfig(
        folder="rendering",
        values={
            "use_sqlalchemy": False,
            "use_legacy_renderer": False,
            # this is specific to mako
            # to make sure inheritance works
            "use_dotted_templatenames": False,
            "renderers": ["jinja"],
            "jinja_filters": {"codify": codify},
            "use_toscawidgets": False,
            "use_toscawidgets2": False,
        },
    )
    app = app_from_config(base_config)

    try:
        resp = app.get("/jinja_filters")
    finally:
        # Remove filters so we don't mess with other test units
        tg.config.pop("jinja_filters")

    assert "8bb23e0b574ecb147536efacc864891b" in resp, resp
开发者ID:moreati,项目名称:tg2,代码行数:33,代码来源:test_rendering.py


示例2: setup_noDB

def setup_noDB():
    base_config = TestConfig(folder = 'config',
                             values = {'use_sqlalchemy': False,
                                       'use_toscawidgets': False,
                                       'use_toscawidgets2':False}
                             )
    return app_from_config(base_config)
开发者ID:984958198,项目名称:tg2,代码行数:7,代码来源:test_config.py


示例3: test_jinja_custom_filters

def test_jinja_custom_filters():
    # Simple test filter to get a md5 hash of a string
    def codify(value):
        try:
            from hashlib import md5
        except ImportError:
            from md5 import md5
        string_hash = md5(value)
        return string_hash.hexdigest()

    base_config = TestConfig(folder = 'rendering',
                             values = {'use_sqlalchemy': False,
                                       'pylons.helpers': Bunch(),
                                       'use_legacy_renderer': False,
                                       # this is specific to mako
                                       # to make sure inheritance works
                                       'use_dotted_templatenames': False,
                                       'pylons.tmpl_context_attach_args': False,
                                       'renderers':['jinja'],
                                       'jinja_filters': {'codify': codify}
                                       }
                             )
    app = app_from_config(base_config)
    resp = app.get('/jinja_filters')
    assert '8bb23e0b574ecb147536efacc864891b' in resp, resp
开发者ID:chiehwen,项目名称:tg2,代码行数:25,代码来源:test_rendering.py


示例4: setup_noDB

def setup_noDB():
    base_config = TestConfig(folder = 'dispatch',
                             values = {'use_sqlalchemy': False,
                             'ignore_parameters': ["ignore", "ignore_me"]
                             }
                             )
    return app_from_config(base_config)
开发者ID:kamroot,项目名称:mc27,代码行数:7,代码来源:test_url_dispatch.py


示例5: test_template_override_content_type

def test_template_override_content_type():
    base_config = TestConfig(
        folder="rendering",
        values={
            "use_sqlalchemy": False,
            "use_legacy_renderer": False,
            # this is specific to mako
            # to make sure inheritance works
            "use_dotted_templatenames": True,
            "renderers": ["mako", "genshi"],
            "use_toscawidgets": False,
            "use_toscawidgets2": False,
        },
    )
    app = app_from_config(base_config)
    r = app.get("/template_override_content_type")
    assert r.content_type == "text/javascript"
    assert "Not overridden" in r, r
    r = app.get("/template_override_content_type", params=dict(override=True))
    assert r.content_type == "text/javascript"
    assert "This is overridden." in r, r
    # now invoke the controller again without override,
    # it should yield the old result
    r = app.get("/template_override_content_type")
    assert "Not overridden" in r, r
开发者ID:moreati,项目名称:tg2,代码行数:25,代码来源:test_rendering.py


示例6: test_template_override_wts

def test_template_override_wts():
    #    app = setup_noDB()
    base_config = TestConfig(
        folder="rendering",
        values={
            "use_sqlalchemy": False,
            "use_legacy_renderer": False,
            # this is specific to mako
            # to make sure inheritance works
            "use_dotted_templatenames": True,
            "renderers": ["genshi"],
            "use_toscawidgets": False,
            "use_toscawidgets2": False,
        },
    )
    app = app_from_config(base_config)
    r = app.get("/template_override_wts", status=301)  # ensure with_trailing_slash
    r = app.get("/template_override_wts/")
    assert "Not overridden" in r, r
    r = app.get("/template_override_wts/", params=dict(override=True))
    assert "This is overridden." in r, r
    # now invoke the controller again without override,
    # it should yield the old result
    r = app.get("/template_override_wts/")
    assert "Not overridden" in r, r
开发者ID:moreati,项目名称:tg2,代码行数:25,代码来源:test_rendering.py


示例7: setup_noDB

def setup_noDB():
    base_config = TestConfig(folder = 'config',
                             values = {'use_sqlalchemy': False,
                                       'pylons.tmpl_context_attach_args': False
                                       }
                             )
    return app_from_config(base_config)
开发者ID:chiehwen,项目名称:tg2,代码行数:7,代码来源:test_config.py


示例8: setup

    def setup(self):
        base_config = TestConfig(folder = 'dispatch',
            values = {'use_sqlalchemy': False,
                      'use_toscawidgets': False,
                      'use_toscawidgets2': False,
                      'ignore_parameters': ["ignore", "ignore_me"]
            })

        self.app = app_from_config(base_config)
开发者ID:Shamefox,项目名称:tg2,代码行数:9,代码来源:test_decorated_controller.py


示例9: setup_noDB

def setup_noDB():
    base_config = TestConfig(folder = 'rendering',
                     values = {'use_sqlalchemy': False,
                               'pylons.helpers': Bunch(),
                               # we want to test the new renderer functions
                               'use_legacy_renderer': False,
                               # in this test we want dotted names support
                               'use_dotted_templatenames': True,
                               }
                             )
    return app_from_config(base_config)
开发者ID:chiehwen,项目名称:tg2,代码行数:11,代码来源:test_dotted_rendering.py


示例10: setup_noDB

def setup_noDB(html_flash=False):
    config = {'use_sqlalchemy': False,
              'use_toscawidgets': False,
              'use_toscawidgets2': False,
              'ignore_parameters': ["ignore", "ignore_me"]}

    if html_flash:
        config['flash.allow_html'] = True

    base_config = TestConfig(folder='dispatch',
                             values=config)
    return app_from_config(base_config)
开发者ID:984958198,项目名称:tg2,代码行数:12,代码来源:test_url_dispatch.py


示例11: make_app

def make_app():
    base_config = TestConfig(folder = 'rendering',
                             values = {'use_sqlalchemy': False,
                                       'use_legacy_renderer': False,
                                       # this is specific to mako
                                       # to make sure inheritance works
                                       'use_dotted_templatenames': False,
                                       'use_toscawidgets': False,
                                       'use_toscawidgets2': False
                                       }
                             )
    return app_from_config(base_config)
开发者ID:984958198,项目名称:tg2,代码行数:12,代码来源:test_decorators.py


示例12: setup

    def setup(self):
        base_config = TestConfig(
            folder="dispatch",
            values={
                "use_sqlalchemy": False,
                "use_toscawidgets": False,
                "use_toscawidgets2": False,
                "ignore_parameters": ["ignore", "ignore_me"],
            },
        )

        self.app = app_from_config(base_config)
开发者ID:ralphbean,项目名称:tg2,代码行数:12,代码来源:test_decorated_controller.py


示例13: setup_noDB

def setup_noDB(prefer_tw2=False):

    base_config = TestConfig(folder = 'rendering',
                     values = {'use_sqlalchemy': False,
                               # we want to test the new renderer functions
                               'use_legacy_renderer': False,
                               # in this test we want dotted names support
                               'use_dotted_templatenames': False,
                               'templating.genshi.method':'xhtml',
                               'prefer_toscawidgets2':prefer_tw2
                               }
                             )
    return app_from_config(base_config)
开发者ID:Cito,项目名称:tg2,代码行数:13,代码来源:test_toscawidgets.py


示例14: make_app

def make_app():
    base_config = TestConfig(folder = 'rendering',
                             values = {'use_sqlalchemy': False,
                                       'pylons.helpers': Bunch(),
                                       'use_legacy_renderer': False,
                                       # this is specific to mako
                                       # to make sure inheritance works
                                       'use_dotted_templatenames': False,
                                       'pylons.tmpl_context_attach_args': False

                                       }
                             )
    return app_from_config(base_config)
开发者ID:kamroot,项目名称:mc27,代码行数:13,代码来源:test_decorators.py


示例15: setUp

 def setUp(self):
     base_config = TestConfig(
         folder="rendering",
         values={
             "use_sqlalchemy": False,
             "use_legacy_renderer": False,
             # this is specific to mako  to make sure inheritance works
             "use_dotted_templatenames": False,
             "use_toscawidgets": False,
             "use_toscawidgets2": False,
             "cache_dir": ".",
         },
     )
     self.app = app_from_config(base_config)
开发者ID:moreati,项目名称:tg2,代码行数:14,代码来源:test_rendering.py


示例16: test_use_default_renderer

    def test_use_default_renderer(self):
        base_config = TestConfig(folder = 'dispatch',
            values = {'use_sqlalchemy': False,
                      'use_toscawidgets': False,
                      'use_toscawidgets2': False,
                      'ignore_parameters': ["ignore", "ignore_me"]
            })

        app = app_from_config(base_config)

        exposition = tg.expose('nonexisting')
        exposition._resolve_options()

        assert exposition.engine == tg.config['default_renderer']
        assert exposition.template == 'nonexisting'
开发者ID:Shamefox,项目名称:tg2,代码行数:15,代码来源:test_decorated_controller.py


示例17: setup_noDB

def setup_noDB(prefer_tw2=False):

    base_config = TestConfig(
        folder="rendering",
        values={
            "use_sqlalchemy": False,
            # we want to test the new renderer functions
            "use_legacy_renderer": False,
            # in this test we want dotted names support
            "use_dotted_templatenames": False,
            "templating.genshi.method": "xhtml",
            "prefer_toscawidgets2": prefer_tw2,
        },
    )
    return app_from_config(base_config)
开发者ID:moreati,项目名称:tg2,代码行数:15,代码来源:test_toscawidgets.py


示例18: test_expose_without_function_does_nothing

    def test_expose_without_function_does_nothing(self):
        base_config = TestConfig(folder = 'dispatch',
            values = {'use_sqlalchemy': False,
                      'use_toscawidgets': False,
                      'use_toscawidgets2': False,
                      'ignore_parameters': ["ignore", "ignore_me"]
            })

        app = app_from_config(base_config)

        exposition = tg.expose('nonexisting')
        exposition._apply()

        assert exposition._func is None
        assert exposition.engine is None
开发者ID:Shamefox,项目名称:tg2,代码行数:15,代码来源:test_decorated_controller.py


示例19: test_hooks_syswide

    def test_hooks_syswide(self):
        base_config = TestConfig(folder = 'dispatch',
                                 values = {'use_sqlalchemy': False,
                                           'use_toscawidgets': False,
                                           'use_toscawidgets2': False,
                                           'ignore_parameters': ["ignore", "ignore_me"]
                                 })

        def hook(*args, **kw):
            tg.tmpl_context.echo = 'WORKED'

        base_config.register_hook('before_call', hook)
        app = app_from_config(base_config, reset_milestones=False)

        ans = app.get('/echo')
        assert 'WORKED' in ans
开发者ID:Shamefox,项目名称:tg2,代码行数:16,代码来源:test_decorated_controller.py


示例20: setup_noDB

def setup_noDB(extra_init=None):
    base_config = TestConfig(folder = 'rendering',
                     values = {'use_sqlalchemy': False,
                               # we want to test the new renderer functions
                               'use_legacy_renderer': False,
                               # in this test we want dotted names support
                               'use_dotted_templatenames': True,
                               'use_toscawidgets': False,
                               'use_toscawidgets2': False
                               }
                             )

    if extra_init is not None:
        extra_init(base_config)

    return app_from_config(base_config)
开发者ID:Cito,项目名称:tg2,代码行数:16,代码来源:test_dotted_rendering.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_utils.create_parameter_model函数代码示例发布时间:2022-05-27
下一篇:
Python test_pip.write_file函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap