# Path: jose/jws.py
# def sign(payload, key, headers=None, algorithm=ALGORITHMS.HS256):
# def verify(token, key, algorithms, verify=True):
# def get_unverified_header(token):
# def get_unverified_headers(token):
# def get_unverified_claims(token):
# def _encode_header(algorithm, additional_headers=None):
# def _encode_payload(payload):
# def _sign_header_and_claims(encoded_header, encoded_claims, algorithm, key):
# def _load(jwt):
# def _sig_matches_keys(keys, signing_input, signature, alg):
# def _get_keys(key):
# def _verify_signature(signing_input, header, signature, key="", algorithms=None):
# 
# Path: jose/jwt.py
# def encode(claims, key, algorithm=ALGORITHMS.HS256, headers=None, access_token=None):
# def decode(token, key, algorithms=None, options=None, audience=None, issuer=None, subject=None, access_token=None):
# def get_unverified_header(token):
# def get_unverified_headers(token):
# def get_unverified_claims(token):
# def _validate_iat(claims):
# def _validate_nbf(claims, leeway=0):
# def _validate_exp(claims, leeway=0):
# def _validate_aud(claims, audience=None):
# def _validate_iss(claims, issuer=None):
# def _validate_sub(claims, subject=None):
# def _validate_jti(claims):
# def _validate_at_hash(claims, access_token, algorithm):
# def _validate_claims(claims, audience=None, issuer=None, subject=None, algorithm=None, access_token=None, options=None):
# 
# Path: jose/exceptions.py
# class JWTError(JOSEError):
#     pass


import base64
import json
import pytest
from datetime import datetime, timedelta
from jose import jws, jwt
from jose.exceptions import JWTError
        from collections import OrderedDict
        from jose.utils import base64url_decode
    )
    def test_round_trip_with_different_key_types(self, key):
        token = jwt.encode({"testkey": "testvalue"}, key, algorithm="HS256")
        verified_data = jwt.decode(token, key, algorithms=["HS256"])
        assert "testkey" in verified_data.keys()
        assert verified_data["testkey"] == "testvalue"

    def test_leeway_is_int(self):
        pass

    def test_leeway_is_timedelta(self, claims, key):

        nbf = datetime.utcnow() + timedelta(seconds=5)
        leeway = timedelta(seconds=10)

        claims = {
            "nbf": nbf,
        }

        options = {"leeway": leeway}

        token = jwt.encode(claims, key)
        jwt.decode(token, key, options=options)

    def test_iat_not_int(self, key):

        claims = {"iat": "test"}

        token = jwt.encode(claims, key)


# Path: jose/jws.py
# def sign(payload, key, headers=None, algorithm=ALGORITHMS.HS256):
# def verify(token, key, algorithms, verify=True):
# def get_unverified_header(token):
# def get_unverified_headers(token):
# def get_unverified_claims(token):
# def _encode_header(algorithm, additional_headers=None):
# def _encode_payload(payload):
# def _sign_header_and_claims(encoded_header, encoded_claims, algorithm, key):
# def _load(jwt):
# def _sig_matches_keys(keys, signing_input, signature, alg):
# def _get_keys(key):
# def _verify_signature(signing_input, header, signature, key="", algorithms=None):
# 
# Path: jose/jwt.py
# def encode(claims, key, algorithm=ALGORITHMS.HS256, headers=None, access_token=None):
# def decode(token, key, algorithms=None, options=None, audience=None, issuer=None, subject=None, access_token=None):
# def get_unverified_header(token):
# def get_unverified_headers(token):
# def get_unverified_claims(token):
# def _validate_iat(claims):
# def _validate_nbf(claims, leeway=0):
# def _validate_exp(claims, leeway=0):
# def _validate_aud(claims, audience=None):
# def _validate_iss(claims, issuer=None):
# def _validate_sub(claims, subject=None):
# def _validate_jti(claims):
# def _validate_at_hash(claims, access_token, algorithm):
# def _validate_claims(claims, audience=None, issuer=None, subject=None, algorithm=None, access_token=None, options=None):
# 
# Path: jose/exceptions.py
# class JWTError(JOSEError):
#     pass


# Path: tests/test_jwt.py
import base64
import json
import pytest
from datetime import datetime, timedelta
from jose import jws, jwt
from jose.exceptions import JWTError
        from collections import OrderedDict
        from jose.utils import base64url_decode

    )
    def test_round_trip_with_different_key_types(self, key):
        token = jwt.encode({"testkey": "testvalue"}, key, algorithm="HS256")
        verified_data = jwt.decode(token, key, algorithms=["HS256"])
        assert "testkey" in verified_data.keys()
        assert verified_data["testkey"] == "testvalue"

    def test_leeway_is_int(self):
        pass

    def test_leeway_is_timedelta(self, claims, key):

        nbf = datetime.utcnow() + timedelta(seconds=5)
        leeway = timedelta(seconds=10)

        claims = {
            "nbf": nbf,
        }

        options = {"leeway": leeway}

        token = jwt.encode(claims, key)
        jwt.decode(token, key, options=options)

    def test_iat_not_int(self, key):

        claims = {"iat": "test"}

        token = jwt.encode(claims, key)


        with pytest.raises(JWTError):