def test_render(self): """ Test that we can decrypt some data. """ test_key = fernet.Fernet.generate_key() crypted = fernet.Fernet(test_key).encrypt(PLAINTEXT_SECRET.encode()) with patch.object(aws_kms, "_base64_plaintext_data_key", return_value=test_key): self.assertEqual(aws_kms.render(crypted), PLAINTEXT_SECRET)
def test_render(plaintext_secret): """ Test that we can decrypt some data. """ test_key = fernet.Fernet.generate_key() crypted = fernet.Fernet(test_key).encrypt(plaintext_secret.encode()) with patch.object(aws_kms, "_base64_plaintext_data_key", return_value=test_key): assert aws_kms.render(crypted) == plaintext_secret