from django.contrib.auth.models import User from .base import SitemapTestsBase class GenericViewsSitemapTests(SitemapTestsBase): def test_generic_sitemap(self): "A minimal generic sitemap can be rendered" response = self.client.get('/generic/sitemap.xml') expected = '' for username in User.objects.values_list("username", flat=True): expected += "%s/users/%s/" % (self.base_url, username) self.assertEqual(response.content, """ %s """ % expected)