Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made use of assertXMLEqual in sitemaps tests

  • Loading branch information...
commit 08286ca5d93c142a60edda5ee37b3a8a7bc72274 1 parent 6b0a836
Claude Paroz claudep authored
2  django/contrib/sitemaps/tests/generic.py
View
@@ -19,4 +19,4 @@ def test_generic_sitemap(self):
%s
</urlset>
""" % expected
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
14 django/contrib/sitemaps/tests/http.py
View
@@ -26,7 +26,7 @@ def test_simple_sitemap_index(self):
<sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap>
</sitemapindex>
""" % self.base_url
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
@override_settings(
TEMPLATE_DIRS=(os.path.join(os.path.dirname(__file__), 'templates'),)
@@ -40,7 +40,7 @@ def test_simple_sitemap_custom_index(self):
<sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap>
</sitemapindex>
""" % self.base_url
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_simple_sitemap_section(self):
@@ -51,7 +51,7 @@ def test_simple_sitemap_section(self):
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % (self.base_url, date.today())
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_simple_sitemap(self):
"A simple sitemap can be rendered"
@@ -61,7 +61,7 @@ def test_simple_sitemap(self):
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % (self.base_url, date.today())
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
@override_settings(
TEMPLATE_DIRS=(os.path.join(os.path.dirname(__file__), 'templates'),)
@@ -75,7 +75,7 @@ def test_simple_custom_sitemap(self):
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % (self.base_url, date.today())
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
@skipUnless(settings.USE_I18N, "Internationalization is not enabled")
@override_settings(USE_L10N=True)
@@ -101,7 +101,7 @@ def test_requestsite_sitemap(self):
<url><loc>http://testserver/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % date.today()
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
@skipUnless("django.contrib.sites" in settings.INSTALLED_APPS,
"django.contrib.sites app not installed.")
@@ -143,4 +143,4 @@ def test_cached_sitemap_index(self):
<sitemap><loc>%s/cached/sitemap-simple.xml</loc></sitemap>
</sitemapindex>
""" % self.base_url
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
8 django/contrib/sitemaps/tests/https.py
View
@@ -18,7 +18,7 @@ def test_secure_sitemap_index(self):
<sitemap><loc>%s/secure/sitemap-simple.xml</loc></sitemap>
</sitemapindex>
""" % self.base_url
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_secure_sitemap_section(self):
"A secure sitemap section can be rendered"
@@ -28,7 +28,7 @@ def test_secure_sitemap_section(self):
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % (self.base_url, date.today())
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
@override_settings(SECURE_PROXY_SSL_HEADER=False)
@@ -43,7 +43,7 @@ def test_sitemap_index_with_https_request(self):
<sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap>
</sitemapindex>
""" % self.base_url.replace('http://', 'https://')
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_sitemap_section_with_https_request(self):
"A sitemap section requested in HTTPS is rendered with HTTPS links"
@@ -53,4 +53,4 @@ def test_sitemap_section_with_https_request(self):
<url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url>
</urlset>
""" % (self.base_url.replace('http://', 'https://'), date.today())
- self.assertEqual(response.content, expected_content.encode('utf-8'))
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
Please sign in to comment.
Something went wrong with that request. Please try again.