From 4e7c2ba1d7318d60cd371b98bf2afbaebd68acd5 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 8 Feb 2011 12:20:18 +0000 Subject: [PATCH] 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 --- tests/regressiontests/admin_views/tests.py | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 98a2d41ddc..d320db5644 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -441,7 +441,7 @@ class AdminJavaScriptTest(AdminViewBasicTest): response, '' ) - + def testMultiWidgetFirsFieldFocus(self): """ JavaScript-assisted auto-focus should work if a model/ModelAdmin setup @@ -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)