Exemplo n.º 1
0
def test_db(test_client):
    # Create the database and the database table
    db.create_all()

    yield db  # this is where the testing happens!

    # anything after yield is teardown code
    db.session.rollback()
    db.session.remove()
    db.drop_all()
def init_models():
    with app.test_request_context():
        db.drop_all()
        db.create_all()

        user_admin = User(username='******', fullname='admin-user')
        user_admin._set_password('admin-user129_Ftz')
        user_admin_email = UserEmail(email='*****@*****.**',
                                     user=user_admin)

        user = User(username='******', fullname='member-user')
        user._set_password('member-user341_Wer')
        user_email = UserEmail(email='*****@*****.**', user=user)

        profile_owner = User(username='******',
                             fullname='profile-cypress')
        profile_owner._set_password('profile-cypress123_St')
        profile_owner_email = UserEmail(email='*****@*****.**',
                                        user=profile_owner)

        concierge = User(username='******', fullname='concierge-user')
        concierge._set_password('concierge-user34_qQE')
        concierge_email = UserEmail(email='*****@*****.**',
                                    user=concierge)

        usher = User(username='******', fullname='usher-cypress')
        usher._set_password('usher-cypress566_YUt')
        usher_email = UserEmail(email='*****@*****.**', user=usher)

        editor = User(username='******', fullname='editor-cypress')
        editor._set_password('editor-cypress9_GH')
        editor_email = UserEmail(email='*****@*****.**', user=editor)

        user2 = User(username='******', fullname='hg-user')
        user2._set_password('hg-user5_HE')

        db.session.add_all([
            user_admin,
            user_admin_email,
            user,
            user_email,
            profile_owner,
            profile_owner_email,
            concierge,
            concierge_email,
            usher,
            usher_email,
            editor,
            editor_email,
            user2,
        ])
        db.session.commit()
Exemplo n.º 3
0
def test_db_structure(test_client):
    # Create all database tables
    db.create_all()
    yield db
    # Drop all database tables
    db.drop_all()
Exemplo n.º 4
0
 def tearDown(self):
     self.session.rollback()
     db.drop_all()
     self.ctx.pop()
def drop_models():
    with app.test_request_context():
        db.drop_all()
Exemplo n.º 6
0
 def tearDown(self):
     self.session.rollback()
     db.drop_all()
     self.ctx.pop()