Ejemplo n.º 1
0
async def generate_users(mongo, schema, rows, fake):
    values = []
    pw_hash = generate_password_hash('123456')
    for i in range(rows):
        values.append(schema({
            '_id': ObjectId(),
            'username': fake.word()[:50].lower(),
            'email': fake.email(),
            'pw_hash': pw_hash,
        }))
    users = await insert_data(mongo, values)
    return users
Ejemplo n.º 2
0
async def generate_users(mongo, schema, rows, fake):
    values = []
    pw_hash = generate_password_hash('123456')
    for i in range(rows):
        values.append(
            schema({
                '_id': ObjectId(),
                'username': fake.user_name()[:50],
                'email': fake.email(),
                'pw_hash': pw_hash,
            }))
    users = await insert_data(mongo, values)
    return users