def test_logout_token_7():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}, "http://schemas.openid.net/event/foo": {}},
    }
    lt = LogoutToken(**val)
    with pytest.raises(ValueError):
        lt.verify()
def test_logout_token_5():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {"foo": "bar"}},
    }
    lt = LogoutToken(**val)
    with pytest.raises(ValueError):
        lt.verify()
def test_logout_token_with_nonce():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "sid": "08a5019c-17e1-4977-8f42-65a12843ea02",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}},
        "nonce": "1234567890",
    }
    lt = LogoutToken(**val)
    with pytest.raises(MessageException):
        lt.verify()
def test_logout_token_wrong_iss():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "sid": "08a5019c-17e1-4977-8f42-65a12843ea02",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}},
    }
    lt = LogoutToken(**val)
    with pytest.raises(NotForMe):
        lt.verify(iss="deep_purple")

    lt.verify(iss=ISS)
def test_logout_token_wrong_iat():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW + 10,
        "jti": "bWJq",
        "sid": "08a5019c-17e1-4977-8f42-65a12843ea02",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}},
    }
    lt = LogoutToken(**val)
    with pytest.raises(ValueError):
        lt.verify()

    # Within allowed clock skew
    lt.verify(skew=60)
def test_logout_token_3():
    val = {
        "iss": ISS,
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "sid": "08a5019c-17e1-4977-8f42-65a12843ea02",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}},
    }
    lt = LogoutToken(**val)
    assert lt.verify()
def test_logout_token_2():
    val = {
        "iss": ISS,
        "sub": "248289761001",
        "aud": [CLIENT_ID],
        "iat": NOW,
        "jti": "bWJq",
        "events": {BACK_CHANNEL_LOGOUT_EVENT: {}},
    }
    lt = LogoutToken(**val)
    assert lt.verify()