From e3bb9572533ca60291704904d5df6a427fdb5e38 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Sat, 17 Oct 2020 11:40:32 +0200 Subject: [PATCH] Python 3.9: use base64.{decode,encode}bytes The functions base64.decodestring / encodestring are removed from Python 3.9, therefore we must switch to the non deprecated alias. Note that the {decode,encode}bytes have been around for a long time so it's not an issue. Change-Id: I51d2654e5952eccf7894b7e2ecb61a0c19dabe02 --- barbican/tests/plugin/test_store_crypto.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/barbican/tests/plugin/test_store_crypto.py b/barbican/tests/plugin/test_store_crypto.py index 584f2bfd4..824da95e0 100644 --- a/barbican/tests/plugin/test_store_crypto.py +++ b/barbican/tests/plugin/test_store_crypto.py @@ -231,7 +231,7 @@ class WhenTestingStoreCrypto(TestSecretStoreBase): self.assertIsInstance(secret_dto, secret_store.SecretDTO) self.assertEqual(secret_store.SecretType.OPAQUE, secret_dto.type) self.assertEqual( - base64.encodestring(self.decrypted_secret).rstrip(b'\n'), + base64.encodebytes(self.decrypted_secret).rstrip(b'\n'), secret_dto.secret) self.assertEqual( self.encrypted_datum_model.content_type, secret_dto.content_type) @@ -277,7 +277,7 @@ class WhenTestingStoreCrypto(TestSecretStoreBase): secret_type = input_secret_dto.type decrypt_mock = self.retrieving_plugin.decrypt - decrypt_mock.return_value = base64.decodestring(secret) + decrypt_mock.return_value = base64.decodebytes(secret) secret_model = self.context.secret_model secret_model.algorithm = key_spec.alg @@ -703,7 +703,7 @@ class WhenTestingStoreCryptoStoreSecretAndDatum(TestSecretStoreBase): self.assertEqual( self.content_type, test_datum_model.content_type) self.assertEqual( - base64.encodestring(self.cypher_text).rstrip(b'\n'), + base64.encodebytes(self.cypher_text).rstrip(b'\n'), test_datum_model.cypher_text) self.assertEqual( self.response_dto.kek_meta_extended,