@@ -313,27 +313,36 @@ def test_get_or_create(self):
313313 self .assertEqual (obj1 , obj2 )
314314
315315 def test_join (self ):
316- list (Book .objects .filter (author__name = "xxx" ))
316+ msg = (
317+ "Non-empty 'let' field is not allowed in the $lookup aggregation "
318+ "stage over an encrypted collection."
319+ )
320+ with self .assertRaisesMessage (DatabaseError , msg ):
321+ list (Book .objects .filter (author__name = "xxx" ))
317322
318323 def test_order_by (self ):
319324 msg = "Cannot add an encrypted field as a prefix of another encrypted field"
320325 with self .assertRaisesMessage (DatabaseError , msg ):
321326 list (CharModel .objects .order_by ("value" ))
322327
323328 def test_select_related (self ):
324- list (Book .objects .select_related ("author" ))
329+ msg = (
330+ "Non-empty 'let' field is not allowed in the $lookup aggregation "
331+ "stage over an encrypted collection."
332+ )
333+ with self .assertRaisesMessage (DatabaseError , msg ):
334+ list (Book .objects .select_related ("author" ))
325335
326336 def test_update (self ):
327337 msg = "Multi-document updates are not allowed with Queryable Encryption"
328338 with self .assertRaisesMessage (DatabaseError , msg ):
329339 self .assertEqual (CharModel .objects .update (value = "xyz" ), 1 )
330340
331341 def test_update_or_create (self ):
332- # TODO
333- # msg = "Multi-document updates are not allowed with Queryable Encryption"
334- # with self.assertRaisesMessage(DatabaseError, msg):
335- # obj, created = CharModel.objects.update_or_create(value="xyz"), 1)
336- pass
342+ CharModel .objects .create (value = "xyz" )
343+ msg = "Multi-document updates are not allowed with Queryable Encryption"
344+ with self .assertRaisesMessage (DatabaseError , msg ):
345+ CharModel .objects .update_or_create (value = "xyz" , defaults = {"plain" : "abc" })
337346
338347 def test_union (self ):
339348 msg = "Aggregation stage $unionWith is not allowed or supported with automatic encryption."
0 commit comments