Example #1
0
async def test_create_user_with_strong_passwords(password, min_len, expected,
                                                 tmpcwd, app):
    '''Test if method get_or_create_user and strong passwords'''
    auth = NaasAuthenticator(db=app.db)
    auth.check_common_password = True
    auth.minimum_password_length = min_len
    user = auth.get_or_create_user('johnsnow', password)
    assert bool(user) == expected
Example #2
0
async def test_import_from_firstuse_invalid_password(user, pwd, tmpcwd, app):
    with dbm.open('passwords.dbm', 'c', 0o600) as db:
        db[user] = pwd

    auth = NaasAuthenticator(db=app.db)
    auth.check_common_password = True
    with pytest.raises(ValueError):
        auth.add_data_from_firstuse()