@@ -24,7 +24,7 @@ def test_should_successfully_encrypt_and_decrypt_text_message(self):
2424 testMessage = 'Message for test'
2525 encryptedMessage = encryption .encrypt (testMessage )
2626 decryptedMessage = encryption .decrypt (encryptedMessage )
27- self .assertEqual (decryptedMessage , testMessage )
27+ self .assertEqual (decryptedMessage . decode () , testMessage )
2828
2929 def test_should_fail_decryption_when_wrong_private_key_is_used (self ):
3030
@@ -41,7 +41,7 @@ def test_should_fail_decryption_when_wrong_private_key_is_used(self):
4141 with self .assertRaises (HyperwalletException ) as exc :
4242 encryption2 .decrypt (encryptedMessage )
4343
44- self .assertEqual ( exc .exception . message , 'No recipient matched the provided key["Failed: [ValueError(\' Decryption failed.\' ,)]"]' )
44+ self .assertTrue ( str ( exc .exception ). startswith ( 'No recipient matched the provided key["Failed: [ValueError(\' Decryption failed.\' ' ) )
4545
4646 def test_should_fail_signature_verification_when_wrong_public_key_is_used (self ):
4747
@@ -58,7 +58,7 @@ def test_should_fail_signature_verification_when_wrong_public_key_is_used(self):
5858 with self .assertRaises (HyperwalletException ) as exc :
5959 encryption2 .decrypt (encryptedMessage )
6060
61- self .assertEqual (exc .exception . message , 'Signature verification failed.' )
61+ self .assertEqual (str ( exc .exception ) , 'Signature verification failed.' )
6262
6363 def test_should_throw_exception_when_wrong_jwk_key_set_location_is_given (self ):
6464
@@ -212,7 +212,9 @@ def test_should_throw_exception_when_jwk_set_file_retrieved_from_url_is_invalid(
212212 with self .assertRaises (TypeError ) as exc :
213213 encryption .encrypt ('testMessage' )
214214
215- self .assertEqual (exc .exception .message , 'expected string or buffer' )
215+ errorMessages = ['expected string or buffer' , 'the JSON object must be str, bytes or bytearray, not MagicMock' ]
216+
217+ self .assertTrue (str (exc .exception ) in errorMessages )
216218
217219 def __findJwkKeyByAlgorithm (self , jwkKeySet , algorithm ):
218220 '''
0 commit comments