Skip to content

Commit 23de328

Browse files
committed
Update test_changelist_view_list_editable_changed_objects_uses_filter for $expr removal
for mongodb/django-mongodb-backend#373
1 parent 26ad30f commit 23de328

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/admin_changelist/tests.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,17 @@ def test_changelist_view_list_editable_changed_objects_uses_filter(self):
13391339
self.assertEqual(response.status_code, 200)
13401340
# Check only the first few characters of the pk since the UUID has
13411341
# dashes.
1342-
self.assertIn(
1343-
"{'$match': {'$expr': {'$in': ['$uuid', ('%s" % str(a.pk)[:8],
1344-
context.captured_queries[4]["sql"],
1345-
)
1342+
try:
1343+
self.assertIn(
1344+
"{'$match': {'uuid': {'$in': ('%s" % str(a.pk)[:8],
1345+
context.captured_queries[4]["sql"],
1346+
)
1347+
except AssertionError:
1348+
# pre https://github.com/mongodb/django-mongodb-backend/pull/373
1349+
self.assertIn(
1350+
"{'$match': {'$expr': {'$in': ['$uuid', ('%s" % str(a.pk)[:8],
1351+
context.captured_queries[4]["sql"],
1352+
)
13461353

13471354
def test_list_editable_error_title(self):
13481355
a = Swallow.objects.create(origin="Swallow A", load=4, speed=1)

0 commit comments

Comments
 (0)