示例#1
0
def test_verify_exp_in_future(app):
    """Test that token expiry is verified as being in future."""
    payload = dict(
        foo=1, exp=datetime.datetime.utcnow() - datetime.timedelta(seconds=1)
    )
    t = _jwt_encode_dangerous(payload)
    with pytest.raises(jwt.exceptions.ExpiredSignatureError):
        _jwt_decode(t)
示例#2
0
def test_verify_exp_present(app):
    """Test that token expiry is verified as being present."""
    payload = dict(foo=1)
    t = _jwt_encode_dangerous(payload)
    with pytest.raises(jwt.exceptions.MissingRequiredClaimError):
        _jwt_decode(t)