Exemplo n.º 1
0
def test_login_if_passed_hashed():
    from everything.components import AuthComponent

    auth_component = AuthComponent()

    password = "******"
    hashed_password = auth_component.get_hashed_value(password)

    user = User(password=hashed_password)
    user_with_component = User(password=hashed_password, auth_component=auth_component)

    assert user.login(password) == False
    assert user.login(hashed_password) == True

    assert user_with_component.login(password) == True
    assert user_with_component.login(hashed_password) == False
Exemplo n.º 2
0
def test_get_hashed_value():
    auth = AuthComponent(salt="abcdefg"*7)
    s = "this is test"
    assert s != auth.get_hashed_value(s)