コード例 #1
0
def test_web_on_loaded_with_callable():
    conf = WebConfiguration({
        'web': {
            'on_loaded': "assert app(self) == 'ok'",
        },
    })
    log = []
    conf.on_web_loaded(lambda self: log.append(self) or 'ok')
    assert log == [conf]
コード例 #2
0
def test_web_on_loaded_hooks_list():
    conf = WebConfiguration({
        'web': {
            'on_loaded': [__name__ + ':' + sample_hook.__name__],
        },
    })
    app = Flask(__name__)
    conf.on_web_loaded(app)
    assert app.name == 'ok'
コード例 #3
0
ファイル: flask_test.py プロジェクト: dahlia/settei
def test_web_on_loaded():
    conf = WebConfiguration({
        'web': {
            'on_loaded': "assert app(self) == 'ok'",
        },
    })
    log = []
    conf.on_web_loaded(lambda self: log.append(self) or 'ok')
    assert log == [conf]
コード例 #4
0
def test_web_on_loaded():
    conf = WebConfiguration({
        'web': {
            'on_loaded':
            "assert app.name == '{}'\n"
            "app.name = 'ok'".format(__name__),
        },
    })
    app = Flask(__name__)
    conf.on_web_loaded(app)
    assert app.name == 'ok'