Beispiel #1
0
def test_user_password():
    """ Test user password
  """
    user = User(email="*****@*****.**", user_type=0)
    user.SetPassword("test_pwd")
    assert user.VerifyPassword("test_pwd")
    assert not user.VerifyPassword("wrong_pwd")
    assert not user.VerifyPassword(None)
Beispiel #2
0
def test_invalid_length_for_new_password():
    """ Test new password with invalid length (< 4 or > 20)
  provided by user
  """
    user = User(email="*****@*****.**", user_type=0)
    user_password = "******"
    user.SetPassword(user_password)

    new_password1 = "pwd"
    with pytest.raises(ValueError):
        user.SetPassword(new_password1)
    assert not user.VerifyPassword(new_password1)
    assert user.VerifyPassword(user_password)

    new_password2 = "I love meatball and tuna."
    with pytest.raises(ValueError):
        user.SetPassword(new_password2)
    assert not user.VerifyPassword(new_password2)
    assert user.VerifyPassword(user_password)