@@ -193,13 +193,13 @@ def test_hmac_from_keyrep():
193193
194194
195195def test_left_hash_hs256 ():
196- hsh = jws .left_hash (b 'Please take a moment to register today' )
197- assert hsh == b 'rCFHVJuxTqRxOsn2IUzgvA'
196+ hsh = jws .left_hash ('Please take a moment to register today' )
197+ assert hsh == 'rCFHVJuxTqRxOsn2IUzgvA'
198198
199199
200200def test_left_hash_hs512 ():
201- hsh = jws .left_hash (b 'Please take a moment to register today' , "HS512" )
202- assert hsh == b '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
201+ hsh = jws .left_hash ('Please take a moment to register today' , "HS512" )
202+ assert hsh == '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
203203
204204
205205def test_rs256 ():
@@ -349,7 +349,7 @@ def test_signer_ps256_fail():
349349 keys = [RSAKey (key = import_rsa_key_from_file (KEY ))]
350350 #keys[0]._keytype = "private"
351351 _jws = JWS (payload , alg = "PS256" )
352- _jwt = _jws .sign_compact (keys )[:- 5 ] + b 'abcde'
352+ _jwt = _jws .sign_compact (keys )[:- 5 ] + 'abcde'
353353
354354 _rj = JWS ()
355355 try :
@@ -428,9 +428,9 @@ def test_signer_protected_headers():
428428
429429 exp_protected = protected .copy ()
430430 exp_protected ['alg' ] = 'ES256'
431- enc_header , enc_payload , sig = _jwt .split (b '.' )
432- assert json .loads (b64d (enc_header ).decode ("utf-8" )) == exp_protected
433- assert b64d (enc_payload ).decode ("utf-8" ) == payload
431+ enc_header , enc_payload , sig = _jwt .split ('.' )
432+ assert json .loads (b64d (enc_header . encode ( "utf-8" ) ).decode ("utf-8" )) == exp_protected
433+ assert b64d (enc_payload . encode ( "utf-8" ) ).decode ("utf-8" ) == payload
434434
435435 _rj = JWS ()
436436 info = _rj .verify_compact (_jwt , keys )
@@ -444,7 +444,7 @@ def test_verify_protected_headers():
444444 protected = dict (header1 = u"header1 is protected" ,
445445 header2 = "header2 is protected too" , a = 1 )
446446 _jwt = _jws .sign_compact (keys , protected = protected )
447- protectedHeader , enc_payload , sig = _jwt .split (b "." )
447+ protectedHeader , enc_payload , sig = _jwt .split ("." )
448448 data = dict (payload = enc_payload , signatures = [
449449 dict (
450450 header = dict (alg = u"ES256" , jwk = _key .serialize ()),
0 commit comments