Beispiel #1
0
    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 after_request(response):
    DATABASE.close()
    return response
Beispiel #3
0
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
Beispiel #4
0
 def tearDown(self):
     """teardown all initialized variables."""
     with self.app.app_context():
         # drop all tables
         DATABASE.close()