def test_mongocrypt(self): kms_providers = { 'aws': { 'accessKeyId': 'foo', 'secretAccessKey': 'foo' } } opts = MongoCryptOptions(kms_providers) mc = MongoCrypt(opts) mc.close() mc.close()
def test_mongocrypt_validation(self): with self.assertRaisesRegex(TypeError, 'options must be a MongoCryptOptions'): MongoCrypt({}) with self.assertRaisesRegex(TypeError, 'options must be a MongoCryptOptions'): MongoCrypt(None) invalid_key_len_opts = MongoCryptOptions({'local': {'key': b'1'}}) with self.assertRaisesRegex(MongoCryptError, "local key must be 96 bytes"): MongoCrypt(invalid_key_len_opts)