3131
3232OPTS = CodecOptions (uuid_representation = STANDARD )
3333
34- try :
35- import pymongocrypt # noqa: F401
3634
37- _HAVE_PYMONGOCRYPT = True
38- except ImportError :
39- _HAVE_PYMONGOCRYPT = False
40-
41-
42- @env .require_version_min (4 , 2 , - 1 )
4335class TestExplicitSimple (AsyncIOTestCase ):
36+ @env .require_csfle
4437 def setUp (self ):
4538 super ().setUp ()
46- if not _HAVE_PYMONGOCRYPT :
47- self .fail ("PyMongoCrypt is a required dependency" )
4839
4940 def assertEncrypted (self , val ):
5041 self .assertIsInstance (val , Binary )
@@ -142,7 +133,6 @@ async def test_codec_options(self):
142133 client_encryption_legacy = AsyncIOMotorClientEncryption (
143134 KMS_PROVIDERS , "keyvault.datakeys" , client , opts
144135 )
145- # self.addCleanup(client_encryption_legacy.close)
146136
147137 # Create the encrypted field's data key.
148138 key_id = await client_encryption_legacy .create_data_key ("local" )
@@ -168,9 +158,13 @@ async def test_codec_options(self):
168158 # Test that codec_options is applied during encryption.
169159 self .assertNotEqual (encrypted_standard , encrypted_legacy )
170160 # Test that codec_options is applied during decryption.
171- self .assertEqual (await client_encryption_legacy .decrypt (encrypted_standard ), value )
161+ self .assertEqual (
162+ await client_encryption_legacy .decrypt (encrypted_standard ),
163+ Binary .from_uuid (value , uuid_representation = STANDARD ),
164+ )
172165 self .assertNotEqual (await client_encryption .decrypt (encrypted_legacy ), value )
173166
167+ await client_encryption_legacy .close ()
174168 await client_encryption .close ()
175169
176170 @asyncio_test
0 commit comments