11import json
22
33import pytest
4- import six
54
65import jose .backends
76from jose import jwe
@@ -429,7 +428,7 @@ def test_alg_enc_headers(self):
429428 enc = ALGORITHMS .A256CBC_HS512
430429 alg = ALGORITHMS .RSA_OAEP_256
431430 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg )
432- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
431+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
433432 assert header ["enc" ] == enc
434433 assert header ["alg" ] == alg
435434
@@ -439,15 +438,15 @@ def test_cty_header_present_when_provided(self):
439438 alg = ALGORITHMS .RSA_OAEP_256
440439 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg ,
441440 cty = "expected" )
442- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
441+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
443442 assert header ["cty" ] == "expected"
444443
445444 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
446445 def test_cty_header_not_present_when_not_provided (self ):
447446 enc = ALGORITHMS .A256CBC_HS512
448447 alg = ALGORITHMS .RSA_OAEP_256
449448 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg )
450- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
449+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
451450 assert "cty" not in header
452451
453452 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
@@ -456,15 +455,15 @@ def test_zip_header_present_when_provided(self):
456455 alg = ALGORITHMS .RSA_OAEP_256
457456 encrypted = jwe .encrypt (b"Text" , PUBLIC_KEY_PEM , enc , alg ,
458457 zip = ZIPS .DEF )
459- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
458+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
460459 assert header ["zip" ] == ZIPS .DEF
461460
462461 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
463462 def test_zip_header_not_present_when_not_provided (self ):
464463 enc = ALGORITHMS .A256CBC_HS512
465464 alg = ALGORITHMS .RSA_OAEP_256
466465 encrypted = jwe .encrypt (b"Text" , PUBLIC_KEY_PEM , enc , alg )
467- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
466+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
468467 assert "zip" not in header
469468
470469 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
@@ -473,7 +472,7 @@ def test_zip_header_not_present_when_none(self):
473472 alg = ALGORITHMS .RSA_OAEP_256
474473 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg ,
475474 zip = ZIPS .NONE )
476- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
475+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
477476 assert "zip" not in header
478477
479478 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
@@ -482,13 +481,13 @@ def test_kid_header_present_when_provided(self):
482481 alg = ALGORITHMS .RSA_OAEP_256
483482 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg ,
484483 kid = "expected" )
485- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
484+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
486485 assert header ["kid" ] == "expected"
487486
488487 @pytest .mark .skipif (AESKey is None , reason = "No AES backend" )
489488 def test_kid_header_not_present_when_not_provided (self ):
490489 enc = ALGORITHMS .A256CBC_HS512
491490 alg = ALGORITHMS .RSA_OAEP_256
492491 encrypted = jwe .encrypt ("Text" , PUBLIC_KEY_PEM , enc , alg )
493- header = json .loads (six . ensure_str ( base64url_decode (encrypted .split (b"." )[0 ]) ))
492+ header = json .loads (base64url_decode (encrypted .split (b"." )[0 ]))
494493 assert "kid" not in header
0 commit comments