1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Moved contrib.sitemaps tests out of contrib.

This commit is contained in:
Tim Graham
2015-02-10 08:11:25 -05:00
parent d8341bf024
commit fbc467c26b
13 changed files with 43 additions and 47 deletions

View File

@@ -0,0 +1,23 @@
from __future__ import unicode_literals
from django.test import override_settings
from .base import SitemapTestsBase
from .models import TestModel
@override_settings(ABSOLUTE_URL_OVERRIDES={})
class GenericViewsSitemapTests(SitemapTestsBase):
def test_generic_sitemap(self):
"A minimal generic sitemap can be rendered"
response = self.client.get('/generic/sitemap.xml')
expected = ''
for pk in TestModel.objects.values_list("id", flat=True):
expected += "<url><loc>%s/testmodel/%s/</loc></url>" % (self.base_url, pk)
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
%s
</urlset>
""" % expected
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)