def test_published_script(): here = dirname(__file__) fn = join(here, 'cheese_shop_publish.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions assert len(funcs) == 1
def tranquilized_funcs(): here = dirname(__file__) fn = join(here, 'cheese_shop.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions return funcs
def protected_funcs(): here = dirname(__file__) fn = join(here, 'protected.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions return funcs
def error_funcs(): here = dirname(__file__) fn = join(here, 'integer_error.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions return funcs
def test_projected_func_without_secret_key(): here = dirname(__file__) fn = join(here, 'protected.py') script = ScriptHandler(fn) script.parse() tranquilized_funcs = script.tranquilized_functions with pytest.raises(RuntimeError): app = make_app(tranquilized_funcs, 'cheese')
def test_app_function(): here = dirname(__file__) fn = join(here, 'cheese_shop.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions app = make_app(funcs, 'cheese') assert len(app.blueprints) == 1
def test_content_length(): here = dirname(__file__) fn = join(here, 'cheese_shop.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions app = make_app(funcs, 'cheese', max_content_length=1024) assert app.config['MAX_CONTENT_LENGTH'] == 1024
def test_proxy_fix(): here = dirname(__file__) fn = join(here, 'cheese_shop.py') script = ScriptHandler(fn) script.parse() funcs = script.tranquilized_functions app = make_app(funcs, 'cheese') assert isinstance(app.wsgi_app, ProxyFix)
def test_projected_func_with_secret_key(): here = dirname(__file__) fn = join(here, 'protected.py') script = ScriptHandler(fn) script.parse() tranquilized_funcs = script.tranquilized_functions secret_key = 'tranquilizer' app = make_app(tranquilized_funcs, 'cheese', secret_key=secret_key) assert app.config['JWT_SECRET_KEY'] == secret_key
def test_script_parser(): here = dirname(__file__) fn = join(here, 'cheese_shop.py') script = ScriptHandler(fn) script.parse() assert [hasattr(script, attr) for attr in ['modules', 'nodes']]