Beispiel #1
0
 def run(self):
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///ESA/test.db'
     app.db = models.init_app(app)
     app.db.drop_all()
     models.create_tables(app)
     fixtures.install(app, *fixtures.all_data)
     app.run()
     app.db.session.remove()
     app.db.drop_all()
Beispiel #2
0
    except Exception, e:
        return abort(404)

    return abort(403)

        
@app.errorhandler(403)
def page_not_found(e):
    return render_template('403.html'), 403

@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404


@app.teardown_request
def shutdown_session(exception=None):
    db.session.remove()

if __name__ == '__main__':
    app.run()   

class InitTest(TestCase):

    def my_small_test(self):

        app = Flask(__name__)
        app.config['TESTING'] = True
        return app