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


Python test_stack.app_from_config函数代码示例

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


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


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