def setUp(self): """Before each test...""" # Connect to test db connect_to_db(s.app, "postgresql:///testdb", False) # If we stop a test midway, let's make sure there's nothing in the db # on the next start up. db.reflect() db.drop_all() # Create tables and add sample data db.create_all() db.session.commit() sample_data()
def tearDown(self): """After every test...""" db.session.close() db.reflect() db.drop_all()
from flask import * from werkzeug.utils import secure_filename import os import re from model import * from model import db app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///baseRotonde.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS']= False db = SQLAlchemy(app) with app.app_context() : db.reflect() db.drop_all()