Repository: VNG-Realisatie/vng-api-common (language: python)

Issue:
Support PyJWT 2.0.0+
There's a breaking change . `encode` and `decode` no longer operate on bytestrings, but on regular strings now. It's been dealt with in gemma-zds-client already.


Discussion / hints:

Fix patch:
diff --git a/setup.cfg b/setup.cfg
index 56c7bcfe..7ccc7030 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -43,7 +43,7 @@ install_requires =
     django-rest-framework-condition
     drf-yasg>=1.20.0
     drf-nested-routers>=0.93.3
-    gemma-zds-client>=0.13.0
+    gemma-zds-client>=0.14.0
     iso-639
     isodate
     oyaml


Test patch:
diff --git a/vng_api_common/tests/auth.py b/vng_api_common/tests/auth.py
index 5870c7cc..0df17b9d 100644
--- a/vng_api_common/tests/auth.py
+++ b/vng_api_common/tests/auth.py
@@ -2,11 +2,11 @@
 from typing import List, Optional
 
 from rest_framework import status
+from zds_client.compat import jwt_encode
 
 from ..authorizations.models import Applicatie, AuthorizationsConfig, Autorisatie
 from ..constants import VertrouwelijkheidsAanduiding
 from ..models import JWTSecret
-from .compat import jwt_encode
 
 
 class AuthCheckMixin:
diff --git a/vng_api_common/tests/compat.py b/vng_api_common/tests/compat.py
deleted file mode 100644
index 0996cef0..00000000
--- a/vng_api_common/tests/compat.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import jwt as _jwt
-
-if _jwt.__version__ >= "2.0.0":
-    jwt_encode = _jwt.encode
-else:
-
-    def jwt_encode(*args, **kwargs) -> str:
-        encoded = _jwt.encode(*args, **kwargs)
-        return encoded.decode()  # bytestring to string