diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-30 15:11:21 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-30 15:11:21 +0000 |
| commit | 4d8af2faa3bde14d2f3a5a30b0772b554c8af245 (patch) | |
| tree | e59448868c9e2b1554400848149827ebbe698323 /django/contrib/sitemaps/tests/basic.py | |
| parent | 5295d678b940c7f1bc2d1122d4c9aeb2c0bcd968 (diff) | |
[1.2.X] Fixed #14198 -- Corrected rendering of generic sitemaps when no priority is specified. Thanks to palkeo for the report.
Backport of r13676 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13677 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/sitemaps/tests/basic.py')
| -rw-r--r-- | django/contrib/sitemaps/tests/basic.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/django/contrib/sitemaps/tests/basic.py b/django/contrib/sitemaps/tests/basic.py index 695b84a0ae..5dd2aa2010 100644 --- a/django/contrib/sitemaps/tests/basic.py +++ b/django/contrib/sitemaps/tests/basic.py @@ -1,5 +1,6 @@ from datetime import date from django.conf import settings +from django.contrib.auth.models import User from django.test import TestCase from django.utils.formats import localize from django.utils.translation import activate @@ -10,6 +11,8 @@ class SitemapTests(TestCase): def setUp(self): self.old_USE_L10N = settings.USE_L10N + # Create a user that will double as sitemap content + User.objects.create_user('testuser', 'test@example.com', 's3krit') def tearDown(self): settings.USE_L10N = self.old_USE_L10N @@ -17,11 +20,11 @@ class SitemapTests(TestCase): def test_simple_sitemap(self): "A simple sitemap can be rendered" # Retrieve the sitemap. - response = self.client.get('/sitemaps/sitemap.xml') + response = self.client.get('/simple/sitemap.xml') # Check for all the important bits: self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> -<url><loc>http://example.com/ticket14164</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> +<url><loc>http://example.com/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> """ % date.today().strftime('%Y-%m-%d')) @@ -34,6 +37,17 @@ class SitemapTests(TestCase): # Retrieve the sitemap. Check that priorities # haven't been rendered in localized format - response = self.client.get('/sitemaps/sitemap.xml') + response = self.client.get('/simple/sitemap.xml') self.assertContains(response, '<priority>0.5</priority>') self.assertContains(response, '<lastmod>%s</lastmod>' % date.today().strftime('%Y-%m-%d')) + + def test_generic_sitemap(self): + "A minimal generic sitemap can be rendered" + # Retrieve the sitemap. + response = self.client.get('/generic/sitemap.xml') + # Check for all the important bits: + self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> +<url><loc>http://example.com/users/testuser/</loc></url> +</urlset> +""") |
