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]
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'
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]
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'