Self hosted FLOSS fitness/workout, nutrition and weight tracker
Fix sitemap tests
Roland Geiderf4cab3f5cba5
diff --git a/wger/core/tests/test_sitemap.py b/wger/core/tests/test_sitemap.pyindex 5b120b891..b424b298e 100644--- a/wger/core/tests/test_sitemap.py+++ b/wger/core/tests/test_sitemap.py@@ -24,8 +24,20 @@ class SitemapTestCase(WgerTestCase):Tests the generated sitemap"""- def test_sitemap(self):+ def test_sitemap_index(self):response = self.client.get(reverse('sitemap'))self.assertEqual(response.status_code, 200)- self.assertEqual(len(response.context['urlset']), 18)+ self.assertEqual(len(response.context['sitemaps']), 2)++ def test_sitemap_exercises(self):++ response = self.client.get(reverse('django.contrib.sitemaps.views.sitemap', kwargs={'section': 'exercises'}))+ self.assertEqual(response.status_code, 200)+ self.assertEqual(len(response.context['urlset']), 9)++ def test_sitemap_ingredients(self):++ response = self.client.get(reverse('django.contrib.sitemaps.views.sitemap', kwargs={'section': 'nutrition'}))+ self.assertEqual(response.status_code, 200)+ self.assertEqual(len(response.context['urlset']), 13)diff --git a/wger/urls.py b/wger/urls.pyindex 141b2b766..bbacc3af1 100644--- a/wger/urls.py+++ b/wger/urls.py@@ -114,7 +114,7 @@ urlpatterns = i18n_patterns(path('config/', include(('wger.config.urls', 'config'), namespace='config')),path('gym/', include(('wger.gym.urls', 'gym'), namespace='gym')),path('email', include(('wger.mailer.urls', 'email'), namespace='email')),- path('sitemap.xml', index, {'sitemaps': sitemaps}),+ path('sitemap.xml', index, {'sitemaps': sitemaps}, name='sitemap'),path('sitemap-<section>.xml',sitemap, {'sitemaps': sitemaps},name='django.contrib.sitemaps.views.sitemap')