Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add very simple test for the sitemaps
Roland Geiderb1bfc7e9ded7
diff --git a/wger/manager/tests/__init__.py b/wger/manager/tests/__init__.pyindex bd6fd490e..769153905 100644--- a/wger/manager/tests/__init__.py+++ b/wger/manager/tests/__init__.py@@ -11,3 +11,4 @@ from wger.manager.tests.weight_log import *from wger.manager.tests.copy_workout import *from wger.manager.tests.pdf import *from wger.manager.tests.feedback import *+from wger.manager.tests.sitemap import *diff --git a/wger/manager/tests/sitemap.py b/wger/manager/tests/sitemap.pynew file mode 100644index 000000000..c4ccb1079--- /dev/null+++ b/wger/manager/tests/sitemap.py@@ -0,0 +1,31 @@+# This file is part of Workout Manager.+#+# Workout Manager is free software: you can redistribute it and/or modify+# it under the terms of the GNU Affero General Public License as published by+# the Free Software Foundation, either version 3 of the License, or+# (at your option) any later version.+#+# Workout Manager is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU Affero General Public License++from django.core.urlresolvers import reverse++from django.contrib.auth.models import User++from wger.manager.tests.testcase import WorkoutManagerTestCase+++class SitemapTestCase(WorkoutManagerTestCase):+ '''+ Tests the generated sitemap+ '''++ def test_sitemap(self):++ response = self.client.get(reverse('sitemap'))+ self.assertEqual(response.status_code, 200)+ self.assertEqual(len(response.context['urlset']), 14)diff --git a/wger/workout_manager/urls.py b/wger/workout_manager/urls.pyindex 5f61a4988..d6a74fbbc 100644--- a/wger/workout_manager/urls.py+++ b/wger/workout_manager/urls.py@@ -20,7 +20,10 @@ urlpatterns = i18n_patterns('',url(r'nutrition/', include('wger.nutrition.urls')),url(r'software/', include('wger.software.urls', namespace='software', app_name='software')),url(r'^browserid/', include('django_browserid.urls')),- url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})+ url(r'^sitemap\.xml$',+ 'django.contrib.sitemaps.views.sitemap',+ {'sitemaps': sitemaps},+ name='sitemap'))# Send robots.txt without any language prefix