def test_base_app_class(tmppath): """Test using custom Flask application class.""" class CustomFlask(Flask): pass app = base_app('test', app_class=CustomFlask) assert isinstance(app, CustomFlask)
def test_base_app(tmppath): """Test base app creation.""" # Test default static_url_path and CLI initialization app = base_app('test') assert app.name == 'test' assert app.cli assert app.static_url_path == '/static' assert app.instance_path != tmppath # Test specifying instance path app = base_app('test', instance_path=tmppath) assert app.instance_path == tmppath assert exists(app.instance_path) assert app.static_folder is None # Test automatic instance path creation newpath = join(tmppath, 'test') assert not exists(newpath) app = base_app('test', instance_path=newpath) assert exists(newpath) assert app.static_folder is None # Test static folder staticpath = join(tmppath, 'teststatic') app = base_app('test', static_folder=staticpath) assert app.static_folder == staticpath assert app.instance_path is not None # Test static + instance folder staticpath = join(tmppath, 'teststatic') app = base_app('test', instance_path=tmppath, static_folder=staticpath) assert app.static_folder == staticpath assert app.instance_path == tmppath # Test choice loader searchpath = join(tmppath, "tpls") app = base_app('test', template_folder=searchpath) assert app.jinja_loader.searchpath == [searchpath] app = base_app('test') assert app.jinja_loader.searchpath == [join(app.root_path, 'templates')]