Loading django/contrib/sitemaps/tests/generic.py +3 −1 Original line number Diff line number Diff line from __future__ import unicode_literals from django.contrib.auth.models import User from django.test.utils import override_settings Loading @@ -12,7 +14,7 @@ class GenericViewsSitemapTests(SitemapTestsBase): expected = '' for username in User.objects.values_list("username", flat=True): expected += "<url><loc>%s/users/%s/</loc></url>" % (self.base_url, username) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> %s </urlset> Loading django/contrib/sitemaps/tests/http.py +7 −7 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_index(self): "A simple sitemap index can be rendered" response = self.client.get('/simple/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -33,7 +33,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_custom_index(self): "A simple sitemap index can be rendered with a custom template" response = self.client.get('/simple/custom-index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <!-- This is a customised template --> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> Loading @@ -43,7 +43,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_section(self): "A simple sitemap section can be rendered" response = self.client.get('/simple/sitemap-simple.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -52,7 +52,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap(self): "A simple sitemap can be rendered" response = self.client.get('/simple/sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -64,7 +64,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_custom_sitemap(self): "A simple sitemap can be rendered with a custom template" response = self.client.get('/simple/custom-sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <!-- This is a customised template --> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> Loading @@ -90,7 +90,7 @@ class HTTPSitemapTests(SitemapTestsBase): # installed doesn't raise an exception Site._meta.installed = False response = self.client.get('/simple/sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>http://testserver/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading Loading @@ -131,7 +131,7 @@ class HTTPSitemapTests(SitemapTestsBase): Check that a cached sitemap index can be rendered (#2713). """ response = self.client.get('/cached/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/cached/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading django/contrib/sitemaps/tests/https.py +6 −4 Original line number Diff line number Diff line from __future__ import unicode_literals from datetime import date from django.test.utils import override_settings Loading @@ -11,7 +13,7 @@ class HTTPSSitemapTests(SitemapTestsBase): def test_secure_sitemap_index(self): "A secure sitemap index can be rendered" response = self.client.get('/secure/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/secure/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -20,7 +22,7 @@ class HTTPSSitemapTests(SitemapTestsBase): def test_secure_sitemap_section(self): "A secure sitemap section can be rendered" response = self.client.get('/secure/sitemap-simple.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -34,7 +36,7 @@ class HTTPSDetectionSitemapTests(SitemapTestsBase): def test_sitemap_index_with_https_request(self): "A sitemap index requested in HTTPS is rendered with HTTPS links" response = self.client.get('/simple/index.xml', **self.extra) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -43,7 +45,7 @@ class HTTPSDetectionSitemapTests(SitemapTestsBase): def test_sitemap_section_with_https_request(self): "A sitemap section requested in HTTPS is rendered with HTTPS links" response = self.client.get('/simple/sitemap-simple.xml', **self.extra) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading tests/modeltests/test_client/models.py +1 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class ClientTest(TestCase): content_type="text/xml") self.assertEqual(response.status_code, 200) self.assertEqual(response.templates[0].name, "Book template") self.assertEqual(response.content, "Blink - Malcolm Gladwell") self.assertEqual(response.content, b"Blink - Malcolm Gladwell") def test_redirect(self): "GET a URL that redirects elsewhere" Loading tests/regressiontests/admin_views/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -787,7 +787,7 @@ class CustomModelAdminTest(AdminViewBasicTest): def testCustomAdminSiteView(self): self.client.login(username='super', password='secret') response = self.client.get('/test_admin/%s/my_view/' % self.urlbit) self.assertEqual(response.content, "Django is a magical pony!") self.assertEqual(response.content, b"Django is a magical pony!") def get_perm(Model, perm): """Return the permission object, for the Model""" Loading Loading
django/contrib/sitemaps/tests/generic.py +3 −1 Original line number Diff line number Diff line from __future__ import unicode_literals from django.contrib.auth.models import User from django.test.utils import override_settings Loading @@ -12,7 +14,7 @@ class GenericViewsSitemapTests(SitemapTestsBase): expected = '' for username in User.objects.values_list("username", flat=True): expected += "<url><loc>%s/users/%s/</loc></url>" % (self.base_url, username) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> %s </urlset> Loading
django/contrib/sitemaps/tests/http.py +7 −7 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_index(self): "A simple sitemap index can be rendered" response = self.client.get('/simple/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -33,7 +33,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_custom_index(self): "A simple sitemap index can be rendered with a custom template" response = self.client.get('/simple/custom-index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <!-- This is a customised template --> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> Loading @@ -43,7 +43,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap_section(self): "A simple sitemap section can be rendered" response = self.client.get('/simple/sitemap-simple.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -52,7 +52,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_sitemap(self): "A simple sitemap can be rendered" response = self.client.get('/simple/sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -64,7 +64,7 @@ class HTTPSitemapTests(SitemapTestsBase): def test_simple_custom_sitemap(self): "A simple sitemap can be rendered with a custom template" response = self.client.get('/simple/custom-sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <!-- This is a customised template --> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> Loading @@ -90,7 +90,7 @@ class HTTPSitemapTests(SitemapTestsBase): # installed doesn't raise an exception Site._meta.installed = False response = self.client.get('/simple/sitemap.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>http://testserver/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading Loading @@ -131,7 +131,7 @@ class HTTPSitemapTests(SitemapTestsBase): Check that a cached sitemap index can be rendered (#2713). """ response = self.client.get('/cached/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/cached/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading
django/contrib/sitemaps/tests/https.py +6 −4 Original line number Diff line number Diff line from __future__ import unicode_literals from datetime import date from django.test.utils import override_settings Loading @@ -11,7 +13,7 @@ class HTTPSSitemapTests(SitemapTestsBase): def test_secure_sitemap_index(self): "A secure sitemap index can be rendered" response = self.client.get('/secure/index.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/secure/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -20,7 +22,7 @@ class HTTPSSitemapTests(SitemapTestsBase): def test_secure_sitemap_section(self): "A secure sitemap section can be rendered" response = self.client.get('/secure/sitemap-simple.xml') self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading @@ -34,7 +36,7 @@ class HTTPSDetectionSitemapTests(SitemapTestsBase): def test_sitemap_index_with_https_request(self): "A sitemap index requested in HTTPS is rendered with HTTPS links" response = self.client.get('/simple/index.xml', **self.extra) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> </sitemapindex> Loading @@ -43,7 +45,7 @@ class HTTPSDetectionSitemapTests(SitemapTestsBase): def test_sitemap_section_with_https_request(self): "A sitemap section requested in HTTPS is rendered with HTTPS links" response = self.client.get('/simple/sitemap-simple.xml', **self.extra) self.assertEqual(response.content, """<?xml version="1.0" encoding="UTF-8"?> self.assertEqual(response.content, b"""<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>%s/location/</loc><lastmod>%s</lastmod><changefreq>never</changefreq><priority>0.5</priority></url> </urlset> Loading
tests/modeltests/test_client/models.py +1 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ class ClientTest(TestCase): content_type="text/xml") self.assertEqual(response.status_code, 200) self.assertEqual(response.templates[0].name, "Book template") self.assertEqual(response.content, "Blink - Malcolm Gladwell") self.assertEqual(response.content, b"Blink - Malcolm Gladwell") def test_redirect(self): "GET a URL that redirects elsewhere" Loading
tests/regressiontests/admin_views/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -787,7 +787,7 @@ class CustomModelAdminTest(AdminViewBasicTest): def testCustomAdminSiteView(self): self.client.login(username='super', password='secret') response = self.client.get('/test_admin/%s/my_view/' % self.urlbit) self.assertEqual(response.content, "Django is a magical pony!") self.assertEqual(response.content, b"Django is a magical pony!") def get_perm(Model, perm): """Return the permission object, for the Model""" Loading