def reset_db(app, db): print('Dropping all tables') db.drop_all() # Create all tables print('Creating all tables') db.create_all() # Add users print('Adding users') add_user(app, db, 'bobby', 'Bob', 'User', '*****@*****.**', 'Password1') add_user(app, db, 'jony', 'John', 'User', '*****@*****.**', 'Password1') # user.roles.append(admin_role) db.session.commit()
def reset_db(app, db): """ Delete all tables; Create all tables; Populate roles and users. """ # Drop all tables print('Dropping all tables') db.drop_all() # Create all tables print('Creating all tables') db.create_all() # Adding roles print('Adding roles') admin_role = Role(name='admin') db.session.add(admin_role) # Add users print('Adding users') user = add_user(app, db, 'admin', 'Admin', 'User', '*****@*****.**', 'Password1') user.roles.append(admin_role) db.session.commit()
def test_database(self): db.create_all() self.assertTrue(True)
def create_database(): db.create_all()