diff --git a/autopush/tests/test_integration.py b/autopush/tests/test_integration.py index 675a2f10..2e8d59c4 100644 --- a/autopush/tests/test_integration.py +++ b/autopush/tests/test_integration.py @@ -772,7 +772,15 @@ def test_basic_delivery_with_invalid_vapid_exp(self): payload={"aud": "https://pusher_origin.example.com", "exp": '@', "sub": "mailto:admin@example.com"}) - vapid_info['crypto-key'] = "invalid" + yield client.send_notification( + data=data, + vapid=vapid_info, + status=401) + + vapid_info = _get_vapid( + payload={"aud": "https://pusher_origin.example.com", + "exp": ['@'], + "sub": "mailto:admin@example.com"}) yield client.send_notification( data=data, vapid=vapid_info, diff --git a/autopush/web/webpush.py b/autopush/web/webpush.py index 8c165ad7..0896d163 100644 --- a/autopush/web/webpush.py +++ b/autopush/web/webpush.py @@ -416,7 +416,7 @@ def validate_auth(self, d): try: jwt_expires = int(jwt['exp']) - except ValueError: + except (ValueError, TypeError): raise InvalidRequest("Invalid bearer token: Invalid expiration", status_code=401, errno=109, headers={"www-authenticate": PREF_SCHEME})