Ticket #14447: fixes_trunk.diff
File fixes_trunk.diff, 3.1 KB (added by , 14 years ago) |
---|
-
contrib/auth/tests/decorators.py
1 from django.conf import settings 1 2 from django.contrib.auth.decorators import login_required 2 3 from django.contrib.auth.tests.views import AuthViewsTestCase 3 4 … … 24 25 pass 25 26 login_required(normal_view) 26 27 27 def testLoginRequired(self, view_url='/login_required/', login_url= '/login/'):28 def testLoginRequired(self, view_url='/login_required/', login_url=settings.LOGIN_URL): 28 29 """ 29 30 Check that login_required works on a simple view wrapped in a 30 31 login_required decorator. -
contrib/sitemaps/tests/basic.py
1 1 from datetime import date 2 2 from django.conf import settings 3 3 from django.contrib.auth.models import User 4 from django.contrib.flatpages.models import FlatPage5 4 from django.contrib.sitemaps import Sitemap 6 5 from django.contrib.sites.models import Site 7 6 from django.core.exceptions import ImproperlyConfigured 8 7 from django.test import TestCase 8 from django.utils.unittest import skipUnless 9 9 from django.utils.formats import localize 10 10 from django.utils.translation import activate, deactivate 11 11 … … 52 52 "A minimal generic sitemap can be rendered" 53 53 # Retrieve the sitemap. 54 54 response = self.client.get('/generic/sitemap.xml') 55 56 expected = '' 57 for username in User.objects.values_list("username", flat=True): 58 expected += "<url><loc>http://example.com/users/%s/</loc></url>" %username 55 59 # Check for all the important bits: 56 60 self.assertEquals(response.content, """<?xml version="1.0" encoding="UTF-8"?> 57 61 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 58 <url><loc>http://example.com/users/testuser/</loc></url> 62 %s 59 63 </urlset> 60 """ )64 """ %expected) 61 65 66 @skipUnless("django.contrib.flatpages" in settings.INSTALLED_APPS, "django.contrib.flatpages app not installed.") 62 67 def test_flatpage_sitemap(self): 63 68 "Basic FlatPage sitemap test" 69 70 # Import FlatPage inside the test so that when django.contrib.flatpages 71 # is not installed we don't get problems trying to delete Site 72 # objects (FlatPage has an M2M to Site, Site.delete() tries to 73 # delete related objects, but the M2M table doesn't exist. 74 from django.contrib.flatpages.models import FlatPage 75 64 76 public = FlatPage.objects.create( 65 77 url=u'/public/', 66 78 title=u'Public Page', … … 85 97 # Make sure hitting the flatpages sitemap without the sites framework 86 98 # installed doesn't raise an exception 87 99 Site._meta.installed = False 88 response = self.client.get('/flatpages/sitemap.xml')89 100 # Retrieve the sitemap. 90 101 response = self.client.get('/simple/sitemap.xml') 91 102 # Check for all the important bits: