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
This commit is contained in:
Thomas Goirand 2020-10-17 11:40:32 +02:00
parent 49de1a9d34
commit e3bb957253

View File

@ -231,7 +231,7 @@ class WhenTestingStoreCrypto(TestSecretStoreBase):
self.assertIsInstance(secret_dto, secret_store.SecretDTO) self.assertIsInstance(secret_dto, secret_store.SecretDTO)
self.assertEqual(secret_store.SecretType.OPAQUE, secret_dto.type) self.assertEqual(secret_store.SecretType.OPAQUE, secret_dto.type)
self.assertEqual( self.assertEqual(
base64.encodestring(self.decrypted_secret).rstrip(b'\n'), base64.encodebytes(self.decrypted_secret).rstrip(b'\n'),
secret_dto.secret) secret_dto.secret)
self.assertEqual( self.assertEqual(
self.encrypted_datum_model.content_type, secret_dto.content_type) self.encrypted_datum_model.content_type, secret_dto.content_type)
@ -277,7 +277,7 @@ class WhenTestingStoreCrypto(TestSecretStoreBase):
secret_type = input_secret_dto.type secret_type = input_secret_dto.type
decrypt_mock = self.retrieving_plugin.decrypt 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 = self.context.secret_model
secret_model.algorithm = key_spec.alg secret_model.algorithm = key_spec.alg
@ -703,7 +703,7 @@ class WhenTestingStoreCryptoStoreSecretAndDatum(TestSecretStoreBase):
self.assertEqual( self.assertEqual(
self.content_type, test_datum_model.content_type) self.content_type, test_datum_model.content_type)
self.assertEqual( self.assertEqual(
base64.encodestring(self.cypher_text).rstrip(b'\n'), base64.encodebytes(self.cypher_text).rstrip(b'\n'),
test_datum_model.cypher_text) test_datum_model.cypher_text)
self.assertEqual( self.assertEqual(
self.response_dto.kek_meta_extended, self.response_dto.kek_meta_extended,