Skip to content

Commit 1b0a5b9

Browse files
committed
update tests for new error message after $facet removal
1 parent c5d2a1c commit 1b0a5b9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/encryption_/test_fields.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from operator import attrgetter
55

66
from bson import ObjectId
7+
from django.conf import settings
78
from django.db import DatabaseError
89
from django.db.models import Avg, F, Q
910

@@ -245,9 +246,11 @@ def test_time(self):
245246
class QueryTests(EncryptionTestCase):
246247
def test_aggregate(self):
247248
msg = (
248-
"Aggregation stage $internalFacetTeeConsumer is not allowed or "
249-
"supported with automatic encryption."
249+
'csfle "analyze_query" failed: Missing encryption schema for '
250+
f"namespace: {settings.DATABASES['encrypted']['NAME']}.$cmd.aggregate"
250251
)
252+
IntegerModel.objects.create(value=1)
253+
IntegerModel.objects.create(value=3)
251254
with self.assertRaisesMessage(DatabaseError, msg):
252255
list(IntegerModel.objects.aggregate(Avg("value")))
253256

@@ -291,12 +294,14 @@ def test_contains(self):
291294
self.assertIs(CharModel.objects.contains(obj), True)
292295

293296
def test_count(self):
297+
CharModel.objects.create(value="a")
298+
CharModel.objects.create(value="b")
294299
msg = (
295-
"Aggregation stage $internalFacetTeeConsumer is not allowed or "
296-
"supported with automatic encryption."
300+
'csfle "analyze_query" failed: Missing encryption schema for '
301+
f"namespace: {settings.DATABASES['encrypted']['NAME']}.$cmd.aggregate"
297302
)
298303
with self.assertRaisesMessage(DatabaseError, msg):
299-
list(CharModel.objects.count())
304+
self.assertEqual(CharModel.objects.count(), 2)
300305

301306
def test_dates(self):
302307
msg = (

0 commit comments

Comments
 (0)