Ejemplo n.º 1
0
def initdata():
    """Init the database."""
    admin = User(username='******',
                 email='*****@*****.**',
                 password='******')
    admin.admin = True
    admin.timezone = 'Europe/Paris'
    db.session.add(admin)
    sport = Sport(label='Cycling (Sport)')
    sport.img = '/img/sports/cycling-sport.png'
    sport.is_default = True
    db.session.add(sport)
    sport = Sport(label='Cycling (Transport)')
    sport.img = '/img/sports/cycling-transport.png'
    sport.is_default = True
    db.session.add(sport)
    sport = Sport(label='Hiking')
    sport.img = '/img/sports/hiking.png'
    sport.is_default = True
    db.session.add(sport)
    sport = Sport(label='Mountain Biking')
    sport.img = '/img/sports/mountain-biking.png'
    sport.is_default = True
    db.session.add(sport)
    sport = Sport(label='Running')
    sport.img = '/img/sports/running.png'
    sport.is_default = True
    db.session.add(sport)
    sport = Sport(label='Walking')
    sport.img = '/img/sports/walking.png'
    sport.is_default = True
    db.session.add(sport)
    db.session.commit()
    print('Initial data stored in database.')
Ejemplo n.º 2
0
def user_1_admin():
    admin = User(username='******',
                 email='*****@*****.**',
                 password='******')
    admin.admin = True
    db.session.add(admin)
    db.session.commit()
    return admin
Ejemplo n.º 3
0
def user_1_full():
    user = User(username='******', email='*****@*****.**', password='******')
    user.first_name = 'John'
    user.last_name = 'Doe'
    user.bio = 'just a random guy'
    user.location = 'somewhere'
    user.language = 'en'
    user.timezone = 'America/New_York'
    user.birth_date = datetime.datetime.strptime('01/01/1980', '%d/%m/%Y')
    db.session.add(user)
    db.session.commit()
    return user
Ejemplo n.º 4
0
def test_decode_auth_token(app, user_1):
    auth_token = user_1.encode_auth_token(user_1.id)
    assert isinstance(auth_token, bytes)
    assert User.decode_auth_token(auth_token) == user_1.id
Ejemplo n.º 5
0
def user_2():
    user = User(username='******', email='*****@*****.**', password='******')
    db.session.add(user)
    db.session.commit()
    return user
Ejemplo n.º 6
0
def user_1_paris():
    user = User(username='******', email='*****@*****.**', password='******')
    user.timezone = 'Europe/Paris'
    db.session.add(user)
    db.session.commit()
    return user
Ejemplo n.º 7
0
def user_1():
    user = User(username='******', email='*****@*****.**', password='******')
    db.session.add(user)
    db.session.commit()
    return user
Ejemplo n.º 8
0
def user_3():
    user = User(username='******', email='*****@*****.**', password='******')
    user.weekm = True
    db.session.add(user)
    db.session.commit()
    return user