Ejemplo n.º 1
0
    def test_algorithms_parameter_removes_alg_from_algorithms_list(self, jwt):
        assert 'none' in jwt.get_algorithms()
        assert 'HS256' in jwt.get_algorithms()

        jwt = PyJWT(algorithms=['HS256'])
        assert 'none' not in jwt.get_algorithms()
        assert 'HS256' in jwt.get_algorithms()
Ejemplo n.º 2
0
    def test_ecdsa_related_algorithms(self, jwt):
        jwt = PyJWT()
        jwt_algorithms = jwt.get_algorithms()

        if has_crypto:
            assert 'ES256' in jwt_algorithms
            assert 'ES384' in jwt_algorithms
            assert 'ES512' in jwt_algorithms
        else:
            assert 'ES256' not in jwt_algorithms
            assert 'ES384' not in jwt_algorithms
            assert 'ES512' not in jwt_algorithms
Ejemplo n.º 3
0
    def test_override_options(self):
        jwt = PyJWT(options={'verify_exp': False, 'verify_nbf': False})

        assert not jwt.options['verify_exp']
        assert not jwt.options['verify_nbf']
Ejemplo n.º 4
0
def jwt():
    return PyJWT()