Esempio n. 1
0
def seed_db():
    """Seeds the database."""
    try:
        # Insert test user
        test_user = User(uuid.uuid4().hex)
        test_user.email = user['email']
        test_user.username = user['username']
        test_user.password = generate_password_hash(user['password'])
        test_user.save()
    except Exception as e:
        app.logger.error(e)
    print(user)
Esempio n. 2
0
def solution_put_new_user(new_user_id, user_data):
    app.logger.info("RUNNING TODO#1 SOLUTION CODE:")
    app.logger.info("Put new signup user information!")
    app.logger.info(
        "Follow the steps in the lab guide to replace this method with your own implementation."
    )

    user = User(new_user_id)
    user.email = user_data['email']
    user.password = generate_password_hash(user_data['password'])
    user.username = user_data['username']
    user.save()
    def setUp(self):
        # Delete any test data that may be remained.
        for item in User.scan(User.username.startswith('test')):
            item.delete()
        for item in Photo.scan(Photo.filename_orig.startswith('test')):
            item.delete()

        # Create test user
        test_user = User(uuid.uuid4().hex)
        test_user.email = user['email']
        test_user.username = user['username']
        test_user.password = generate_password_hash(user['password'])
        test_user.save()
Esempio n. 4
0
def solution_put_new_user(new_user_id, user_data):
    user = User(new_user_id)
    user.email = user_data['email']
    user.password = generate_password_hash(user_data['password'])
    user.username = user_data['username']
    user.save()