def test_flask_extension_jinja_env_static_prefix(mocked_flask_app): mocked_flask_app.static_url_path = '/static-url' mocked_flask_app.config = dict() ext = JAC() ext.init_app(mocked_flask_app) assert mocked_flask_app.jinja_env.compressor_static_prefix == '/static-url'
def test_flask_extension_jinja_env_compressor_output_dir(mocked_flask_app): mocked_flask_app.static_folder = '/static/folder' mocked_flask_app.config = dict() ext = JAC() ext.init_app(mocked_flask_app) assert mocked_flask_app.jinja_env.compressor_output_dir == '/static/folder'
def test_flask_extension_jinja_env_static_prefix(mocked_flask_app): mocked_flask_app.static_folder = '/static/folder' mocked_flask_app.static_url_path = '/static-url' mocked_flask_app.config = dict() ext = JAC() ext.init_app(mocked_flask_app) assert mocked_flask_app.jinja_env.compressor_output_dir == '/static/folder/sdist' assert mocked_flask_app.jinja_env.compressor_static_prefix == '/static-url/sdist'
def test_flask_extension_jinja_env_source_dirs(mocked_flask_app): ext = JAC() ext.init_app(mocked_flask_app) mocked_flask_app.jinja_env.compressor_source_dirs == static_finder(mocked_flask_app)
def test_flask_extension_jinja_env_add_extension(mocked_flask_app): ext = JAC() ext.init_app(mocked_flask_app) mocked_flask_app.jinja_env.add_extension.assert_called_once_with('jac.CompilerExtension')
def test_flask_extension_jinja_env_source_dirs(mocked_flask_app): ext = JAC() ext.init_app(mocked_flask_app) mocked_flask_app.jinja_env.compressor_source_dirs == static_finder( mocked_flask_app)
def test_flask_extension_jinja_env_add_extension(mocked_flask_app): ext = JAC() ext.init_app(mocked_flask_app) mocked_flask_app.jinja_env.add_extension.assert_called_once_with( 'jac.CompressorExtension')
def test_flask_extension_lazy_init(mocked_flask_app): """Make sure we save then app when initializing Flask with app factory.""" ext = JAC() assert ext.app is None ext.init_app(mocked_flask_app) assert ext.app == mocked_flask_app