From 05040d82cb2ff60a31a548b3fb99889460601ce2 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 24 Sep 2020 13:41:30 +0100 Subject: [PATCH] Fix test for compatibility with Wagtail 2.11 i18n support Now that Page has a foreign key to Locale, a mapping for the locale object will be pulled across too, so we need to only consider Page mappings when counting. --- tests/tests/test_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tests/test_api.py b/tests/tests/test_api.py index ff38065..3d2f88f 100644 --- a/tests/tests/test_api.py +++ b/tests/tests/test_api.py @@ -374,7 +374,8 @@ def test_streamfield_with_null_page(self): data = json.loads(response.content) # result should have a mapping for the page we just created, and its parent - self.assertEqual(len(data['mappings']), 2) + page_mappings = filter(lambda mapping: mapping[0] == 'wagtailcore.page', data['mappings']) + self.assertEqual(len(list(page_mappings)), 2) def test_parental_many_to_many(self): page = PageWithParentalManyToMany(title="This page has lots of ads!")