def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True self.app = app.test_client() with app.test_request_context(): g.connection = connect_db() g.db = g.connection['game']['games'] init_db()
def before_request(): g.connection = connect_db() g.db = g.connection[DATABASE][COLLECTION]