Example #1
0
def seed_db():
    db.drop_all()
    db.create_all()
    user = app.extensions['security'].datastore.create_user(
        password='******',
        email='*****@*****.**',
        confirmed_at=datetime.datetime.now(),
        active=True)
    user.username = '******'
    db.session.add(user)
    db.session.commit()
    video = Video(file_extension='mov')
    db.session.add(video)
    db.session.commit()
    with open('tests/example.mov', 'rb') as fp:
        s3.upload_video(fp.read(), video.filename)
    lift = Lift(
        name='squat',
        reps='5',
        weight='225',
        video=video,
        user=user,
    )
    db.session.add(lift)
    db.session.commit()
    for _ in range(3):
        comment = Comment(text='This is some text for a comment',
                          lift=lift,
                          user=user)
    db.session.add(comment)
    db.session.commit()
Example #2
0
def seed_db():
    db.drop_all()
    db.create_all()
    user = app.extensions['security'].datastore.create_user(
        password='******',
        email='*****@*****.**',
        confirmed_at=datetime.datetime.now(),
        active=True
    )
    user.username = '******'
    db.session.add(user)
    db.session.commit()
    video = Video(
        file_extension='mov'
    )
    db.session.add(video)
    db.session.commit()
    with open('tests/example.mov', 'rb') as fp:
        s3.upload_video(fp.read(), video.filename)
    lift = Lift(
        name='squat',
        reps='5',
        weight='225',
        video=video,
        user=user,
    )
    db.session.add(lift)
    db.session.commit()
    for _ in range(3):
        comment = Comment(
            text='This is some text for a comment',
            lift=lift,
            user=user
        )
    db.session.add(comment)
    db.session.commit()
Example #3
0
def create_db():
    db.drop_all()
    db.create_all()
Example #4
0
def create_db():
    db.drop_all()
    db.create_all()
Example #5
0
def app():
    os.environ["CONFIG"] = 'config.TestingConfig'
    app = create_app()
    db.drop_all()
    db.create_all()
    return app