Exemple #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]
Exemple #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'
Exemple #3
0
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]
Exemple #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'