def test_cookie_policy_creation(): token_policy = JWTAuthenticationPolicy("secret") request = Request.blank("/") cookie_policy = JWTCookieAuthenticationPolicy.make_from(token_policy) headers = cookie_policy.remember(request, "user") assert isinstance(headers, list) assert len(headers) == 1
def test_cookie_policy_creation_fail(): with pytest.raises(ValueError) as e: JWTCookieAuthenticationPolicy.make_from(object()) assert "Invalid policy type" in str(e.value)