|
@@ -315,6 +315,32 @@ class TestCachePurgingSignals(TestCase):
|
|
|
'http://localhost/pt-br/events/past/',
|
|
|
])
|
|
|
|
|
|
+ @override_settings(ROOT_URLCONF='wagtail.tests.urls_multilang',
|
|
|
+ LANGUAGE_CODE='en',
|
|
|
+ WAGTAIL_I18N_ENABLED=True,
|
|
|
+ WAGTAIL_CONTENT_LANGUAGES=[('en', 'English'), ('fr', 'French')])
|
|
|
+ def test_purge_on_publish_with_i18n_enabled(self):
|
|
|
+ PURGED_URLS[:] = [] # reset PURGED_URLS to the empty list
|
|
|
+ page = EventIndex.objects.get(url_path='/home/events/')
|
|
|
+ page.save_revision().publish()
|
|
|
+
|
|
|
+ self.assertEqual(PURGED_URLS, [
|
|
|
+ 'http://localhost/en/events/',
|
|
|
+ 'http://localhost/en/events/past/',
|
|
|
+ 'http://localhost/fr/events/',
|
|
|
+ 'http://localhost/fr/events/past/',
|
|
|
+ ])
|
|
|
+
|
|
|
+ @override_settings(ROOT_URLCONF='wagtail.tests.urls_multilang',
|
|
|
+ LANGUAGE_CODE='en',
|
|
|
+ WAGTAIL_CONTENT_LANGUAGES=[('en', 'English'), ('fr', 'French')])
|
|
|
+ def test_purge_on_publish_without_i18n_enabled(self):
|
|
|
+ # It should ignore WAGTAIL_CONTENT_LANGUAGES as WAGTAIL_I18N_ENABLED isn't set
|
|
|
+ PURGED_URLS[:] = [] # reset PURGED_URLS to the empty list
|
|
|
+ page = EventIndex.objects.get(url_path='/home/events/')
|
|
|
+ page.save_revision().publish()
|
|
|
+ self.assertEqual(PURGED_URLS, ['http://localhost/en/events/', 'http://localhost/en/events/past/'])
|
|
|
+
|
|
|
|
|
|
class TestPurgeBatchClass(TestCase):
|
|
|
# Tests the .add_*() methods on PurgeBatch. The .purge() method is tested
|