def setUp(self): """Define test variables and initialize app.""" self.app = create_app() self.client = self.app.test_client self.todo = {'name': 'Get a new haircut'} #import pdb; #pdb.set_trace() # binds the app to the current context with self.app.app_context(): # create all tables DATABASE.connect(reuse_if_open=True) DATABASE.create_tables([Todo], safe=True) DATABASE.close()
def before_request(): g.db = DATABASE.connect()
def create_app(): #app.run(debug=config.DEBUG, host=config.HOST, port=config.PORT) DATABASE.connect(reuse_if_open=True) DATABASE.create_tables([Todo], safe=True) DATABASE.close() return app