Example #1
0
def test_parse_auth_cookie_allow_current(current_cookie, with_user,
                                         session_id):
    assert login.user_from_cookie(login._fetch_cookie(current_cookie)) == (
        UserId(with_user[0]),
        session_id,
        login._generate_auth_hash(with_user[0], session_id),
    )
Example #2
0
def test_parse_auth_cookie_refuse_pre_20(pre_20_cookie):
    with pytest.raises(MKAuthException, match="Refusing pre 2.0"):
        login.user_from_cookie(login._fetch_cookie(pre_20_cookie))
Example #3
0
def test_auth_cookie_is_valid_allow_current(current_cookie):
    cookie = login._fetch_cookie(current_cookie)
    assert login.auth_cookie_is_valid(cookie) is True
Example #4
0
def test_auth_cookie_is_valid_refuse_pre_20(pre_20_cookie):
    cookie = login._fetch_cookie(pre_20_cookie)
    assert login.auth_cookie_is_valid(cookie) is False