(self)
| 512 | self.assertEqual(decrypted_ssn, doc["ssn"]) |
| 513 | |
| 514 | def test_validation(self): |
| 515 | client_encryption = self.create_client_encryption( |
| 516 | KMS_PROVIDERS, "keyvault.datakeys", client_context.client, OPTS |
| 517 | ) |
| 518 | |
| 519 | msg = "value to decrypt must be a bson.binary.Binary with subtype 6" |
| 520 | with self.assertRaisesRegex(TypeError, msg): |
| 521 | client_encryption.decrypt("str") # type: ignore[arg-type] |
| 522 | with self.assertRaisesRegex(TypeError, msg): |
| 523 | client_encryption.decrypt(Binary(b"123")) |
| 524 | |
| 525 | msg = "key_id must be a bson.binary.Binary with subtype 4" |
| 526 | algo = Algorithm.AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic |
| 527 | with self.assertRaisesRegex(TypeError, msg): |
| 528 | client_encryption.encrypt("str", algo, key_id=Binary(b"123")) |
| 529 | |
| 530 | def test_bson_errors(self): |
| 531 | client_encryption = self.create_client_encryption( |
nothing calls this directly
no test coverage detected