|
4 | 4 | from operator import attrgetter |
5 | 5 |
|
6 | 6 | from bson import ObjectId |
| 7 | +from django.conf import settings |
7 | 8 | from django.db import DatabaseError |
8 | 9 | from django.db.models import Avg, F, Q |
9 | 10 |
|
@@ -245,9 +246,11 @@ def test_time(self): |
245 | 246 | class QueryTests(EncryptionTestCase): |
246 | 247 | def test_aggregate(self): |
247 | 248 | 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" |
250 | 251 | ) |
| 252 | + IntegerModel.objects.create(value=1) |
| 253 | + IntegerModel.objects.create(value=3) |
251 | 254 | with self.assertRaisesMessage(DatabaseError, msg): |
252 | 255 | list(IntegerModel.objects.aggregate(Avg("value"))) |
253 | 256 |
|
@@ -291,12 +294,14 @@ def test_contains(self): |
291 | 294 | self.assertIs(CharModel.objects.contains(obj), True) |
292 | 295 |
|
293 | 296 | def test_count(self): |
| 297 | + CharModel.objects.create(value="a") |
| 298 | + CharModel.objects.create(value="b") |
294 | 299 | 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" |
297 | 302 | ) |
298 | 303 | with self.assertRaisesMessage(DatabaseError, msg): |
299 | | - list(CharModel.objects.count()) |
| 304 | + self.assertEqual(CharModel.objects.count(), 2) |
300 | 305 |
|
301 | 306 | def test_dates(self): |
302 | 307 | msg = ( |
|
0 commit comments