def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + 'test.db' self.app_context = app.app_context() self.app = app self.client = self.app.test_client() self.app.testing = True db.create_all()
def seed_database(): db.drop_all() db.create_all() hashed_password = generate_password_hash("password") admin = User(email="*****@*****.**", hashed_password=hashed_password, is_admin=True) db.session.add(admin) db.session.commit()
def create(self): ''' Cria o banco de dados se ainda nao foi criado ''' # Verifica se o Banco de dados existe ou nao para evitar sobrescrever if os.path.isfile(self.db_name): print('Database ja Criado') else: with app.app_context(): db.create_all() print( 'Banco de dados criado con sucesso \n \n proceda com o commando: \n ---> python app.py' )
description = db.Column(db.String(5000)) client = db.Column(db.String(50)) client_priority = db.Column(db.Integer()) target_date = db.Column(db.String(100)) product_area = db.Column(db.String(100)) def __init__(self, title, description, client, client_priority, target_date, product_area): """ :param title: :param description: :param client: :param client_priority: :param target_date: :param product_area: """ self.title = title self.description = description self.client = client self.client_priority = client_priority self.target_date = target_date self.product_area = product_area def __repr__(self): return '<Feature Request %r>' % self.title db.create_all() db.session.commit()
def setup_test(self): db.session.commit() db.drop_all() db.create_all()
def init_db(): db.create_all()
def create_db(): """Creates the db tables.""" db.create_all()
def reset(self, app): with app.app_context(): db.drop_all() db.create_all()