python3: encoding variations in auth_fc testing

This commit is contained in:
Paul Marillonnet 2020-02-07 12:46:36 +01:00
parent 4177fc9cb2
commit cb976dc34e
1 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import requests
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.utils.encoding import force_text
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.timezone import now
@ -56,7 +57,8 @@ def get_links_from_mail(mail):
def hmac_jwt(payload, key):
header = {'alg': 'HS256'}
k = jwk.JWK(kty='oct', k=base64.b64encode(key.encode('utf-8')))
k = jwk.JWK(
kty='oct', k=force_text(base64.b64encode(key.encode('utf-8'))))
t = jwt.JWT(header=header, claims=payload)
t.make_signed_token(k)
return t.serialize()