fix test for pyjwt upgrade

This commit is contained in:
Kenneth Kehl
2026-03-17 08:15:56 -07:00
parent 773460dcaf
commit 268136b1b5

View File

@@ -238,23 +238,31 @@ def test_decode_jwt_token_returns_error_with_no_secrets(client):
assert exc.value.short_message == "Invalid token: API key not found"
@pytest.mark.parametrize("service_id", ["not-a-valid-id", 1234])
def test_requires_auth_should_not_allow_service_id_with_the_wrong_data_type(
client, service_jwt_secret, service_id
):
create_jwt_token(
client_id=service_id,
token = create_jwt_token(
client_id="not-a-valid-id",
secret=service_jwt_secret,
)
assert 1 == 0
# request.headers = {"Authorization": "Bearer {}".format(token)}
# with pytest.raises(AuthError) as exc:
# requires_auth()
# assert (
# exc.value.short_message
# == "Invalid token: service id is not the right data type"
# )
request.headers = {"Authorization": "Bearer {}".format(token)}
with pytest.raises(AuthError) as exc:
requires_auth()
assert (
exc.value.short_message
== "Invalid token: service id is not the right data type"
)
def test_requires_auth_should_not_allow_service_id_with_a_non_string(
client, service_jwt_secret, service_id
):
with pytest.raises(TypeError):
create_jwt_token(
client_id=1234,
secret=service_jwt_secret,
)
def test_requires_auth_returns_error_when_service_doesnt_exist(client, sample_api_key):