Exemplo n.º 1
0
    def test_get_signing_keys_raises_if_none_found(self, mocked_response):
        url = "https://dev-87evx9ru.auth0.com/.well-known/jwks.json"

        mocked_key = RESPONSE_DATA["keys"][0].copy()
        mocked_key["use"] = "enc"
        response = {"keys": [mocked_key]}
        with mocked_response(response):
            jwks_client = PyJWKClient(url)

            with pytest.raises(PyJWKClientError) as exc:
                jwks_client.get_signing_keys()

        assert "The JWKS endpoint did not contain any signing keys" in str(
            exc.value)
Exemplo n.º 2
0
    def test_get_signing_keys(self, mocked_response):
        url = "https://dev-87evx9ru.auth0.com/.well-known/jwks.json"

        with mocked_response(RESPONSE_DATA):
            jwks_client = PyJWKClient(url)
            signing_keys = jwks_client.get_signing_keys()

        assert len(signing_keys) == 1
        assert isinstance(signing_keys[0], PyJWK)
Exemplo n.º 3
0
    def test_get_signing_keys(self, mocked_response):
        url = "https://dev-87evx9ru.auth0.com/.well-known/jwks.json"

        with requests_mock.mock() as m:
            m.get(url, json=mocked_response)
            jwks_client = PyJWKClient(url)
            signing_keys = jwks_client.get_signing_keys()

        assert len(signing_keys) == 1
        assert isinstance(signing_keys[0], PyJWK)