Created
December 23, 2013 07:51
-
-
Save vladimirnani/8093185 to your computer and use it in GitHub Desktop.
Test all urls defined in settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from django.core.urlresolvers import reverse | |
from django_project.sitemaps import StaticSitemap | |
from django_project.urls import sitemaps | |
class StaticSitemapTests(TestCase): | |
def setUp(self): | |
names = [name for s in sitemaps.values() | |
if isinstance(s, StaticSitemap) | |
for name in s.names] | |
self.urls = names | |
def test_sitemap(self): | |
""" | |
Every url should return HTTP_200_OK | |
""" | |
for url in self.urls: | |
response = self.client.get(reverse(url)) | |
self.assertEqual(response.status_code, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment