def setUp(self): self.app = app self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client(use_cookies=True) db.create_all() test_user = orm.User(email='*****@*****.**', username='******', password='******', role_id=3, confirmed=True) orm.db.session.add(test_user) try: orm.db.session.commit() except: orm.db.session.rollback()
def create_tables(): db.create_all()
from web.app import db db.create_all()
def setUp(self): self.app = app self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client(use_cookies=True) db.create_all()
def setUp(self): self.app = app self.app_context = self.app.app_context() self.app_context.push() db.create_all()
def create_db(db_first=False): if db_first == False: db.drop_all() db.create_all() db.session.commit()