1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Cleaned up the tests from r15451 to avoid the need to retrieve a URL twice.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2011-02-08 12:20:18 +00:00
parent 74ffca17e2
commit 4e7c2ba1d7

View File

@ -2619,11 +2619,10 @@ class DateHierarchyTests(TestCase):
settings.USE_THOUSAND_SEPARATOR = self.old_USE_THOUSAND_SEPARATOR
settings.USE_L10N = self.old_USE_L10N
def assert_non_localized_year(self, url, year):
def assert_non_localized_year(self, response, year):
"""Ensure that the year is not localized with
USE_THOUSAND_SEPARATOR. Refs #15234.
"""
response = self.client.get(url)
self.assertNotContains(response, formats.number_format(year))
def assert_contains_year_link(self, response, date):
@ -2659,7 +2658,7 @@ class DateHierarchyTests(TestCase):
url = reverse('admin:admin_views_podcast_changelist')
response = self.client.get(url)
self.assert_contains_day_link(response, DATE)
self.assert_non_localized_year(url, 2000)
self.assert_non_localized_year(response, 2000)
def test_within_month(self):
"""
@ -2674,7 +2673,7 @@ class DateHierarchyTests(TestCase):
response = self.client.get(url)
for date in DATES:
self.assert_contains_day_link(response, date)
self.assert_non_localized_year(url, 2000)
self.assert_non_localized_year(response, 2000)
def test_within_year(self):
"""
@ -2691,7 +2690,7 @@ class DateHierarchyTests(TestCase):
self.assertNotContains(response, 'release_date__day=')
for date in DATES:
self.assert_contains_month_link(response, date)
self.assert_non_localized_year(url, 2000)
self.assert_non_localized_year(response, 2000)
def test_multiple_years(self):
"""
@ -2717,15 +2716,15 @@ class DateHierarchyTests(TestCase):
date.year)
response = self.client.get(url)
self.assert_contains_month_link(response, date)
self.assert_non_localized_year(url, 2000)
self.assert_non_localized_year(url, 2003)
self.assert_non_localized_year(url, 2005)
self.assert_non_localized_year(response, 2000)
self.assert_non_localized_year(response, 2003)
self.assert_non_localized_year(response, 2005)
url = '%s?release_date__year=%d&release_date__month=%d' % (
reverse('admin:admin_views_podcast_changelist'),
date.year, date.month)
response = self.client.get(url)
self.assert_contains_day_link(response, date)
self.assert_non_localized_year(url, 2000)
self.assert_non_localized_year(url, 2003)
self.assert_non_localized_year(url, 2005)
self.assert_non_localized_year(response, 2000)
self.assert_non_localized_year(response, 2003)
self.assert_non_localized_year(response, 2005)