def setUp(self): """Define test variables and initialize app.""" self.app = create_app('development') self.client = self.app.test_client # binds the app to the current context with self.app.app_context(): # create all tables db.session.close() db.drop_all() db.create_all()
def client(): #clean database before running #(had issues with previous data) ##CLEANS ALL DB! db.drop_all() db_fd, db_fname = tempfile.mkstemp() app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + db_fname app.config["TESTING"] = True db.create_all() populate_db() yield app.test_client() db.session.remove() #clean db after also, unless debugging problems in this file #db.drop_all() os.close(db_fd) os.unlink(db_fname)
def init_db() -> None: db.init_app(app) # runs CREATE TABLE IF NOT EXISTS ... db.create_all()
def create_tables(): db.create_all()
def criar_banco(): db.create_all()