Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 4e7c2ba1d7318d60cd371b98bf2afbaebd68acd5 1 parent 74ffca1
Russell Keith-Magee authored February 08, 2011

Showing 1 changed file with 11 additions and 12 deletions. Show diff stats Hide diff stats

  1. 23  tests/regressiontests/admin_views/tests.py
23  tests/regressiontests/admin_views/tests.py
@@ -441,7 +441,7 @@ def testSingleWidgetFirsFieldFocus(self):
441 441
             response,
442 442
             '<script type="text/javascript">document.getElementById("id_name").focus();</script>'
443 443
         )
444  
-        
  444
+
445 445
     def testMultiWidgetFirsFieldFocus(self):
446 446
         """
447 447
         JavaScript-assisted auto-focus should work if a model/ModelAdmin setup
@@ -2619,11 +2619,10 @@ def tearDown(self):
2619 2619
         settings.USE_THOUSAND_SEPARATOR = self.old_USE_THOUSAND_SEPARATOR
2620 2620
         settings.USE_L10N = self.old_USE_L10N
2621 2621
 
2622  
-    def assert_non_localized_year(self, url, year):
  2622
+    def assert_non_localized_year(self, response, year):
2623 2623
         """Ensure that the year is not localized with
2624 2624
         USE_THOUSAND_SEPARATOR. Refs #15234.
2625 2625
         """
2626  
-        response = self.client.get(url)
2627 2626
         self.assertNotContains(response, formats.number_format(year))
2628 2627
 
2629 2628
     def assert_contains_year_link(self, response, date):
@@ -2659,7 +2658,7 @@ def test_single(self):
2659 2658
         url = reverse('admin:admin_views_podcast_changelist')
2660 2659
         response = self.client.get(url)
2661 2660
         self.assert_contains_day_link(response, DATE)
2662  
-        self.assert_non_localized_year(url, 2000)
  2661
+        self.assert_non_localized_year(response, 2000)
2663 2662
 
2664 2663
     def test_within_month(self):
2665 2664
         """
@@ -2674,7 +2673,7 @@ def test_within_month(self):
2674 2673
         response = self.client.get(url)
2675 2674
         for date in DATES:
2676 2675
             self.assert_contains_day_link(response, date)
2677  
-        self.assert_non_localized_year(url, 2000)
  2676
+        self.assert_non_localized_year(response, 2000)
2678 2677
 
2679 2678
     def test_within_year(self):
2680 2679
         """
@@ -2691,7 +2690,7 @@ def test_within_year(self):
2691 2690
         self.assertNotContains(response, 'release_date__day=')
2692 2691
         for date in DATES:
2693 2692
             self.assert_contains_month_link(response, date)
2694  
-        self.assert_non_localized_year(url, 2000)
  2693
+        self.assert_non_localized_year(response, 2000)
2695 2694
 
2696 2695
     def test_multiple_years(self):
2697 2696
         """
@@ -2717,15 +2716,15 @@ def test_multiple_years(self):
2717 2716
                   date.year)
2718 2717
             response = self.client.get(url)
2719 2718
             self.assert_contains_month_link(response, date)
2720  
-            self.assert_non_localized_year(url, 2000)
2721  
-            self.assert_non_localized_year(url, 2003)
2722  
-            self.assert_non_localized_year(url, 2005)
  2719
+            self.assert_non_localized_year(response, 2000)
  2720
+            self.assert_non_localized_year(response, 2003)
  2721
+            self.assert_non_localized_year(response, 2005)
2723 2722
 
2724 2723
             url = '%s?release_date__year=%d&release_date__month=%d' % (
2725 2724
                   reverse('admin:admin_views_podcast_changelist'),
2726 2725
                   date.year, date.month)
2727 2726
             response = self.client.get(url)
2728 2727
             self.assert_contains_day_link(response, date)
2729  
-            self.assert_non_localized_year(url, 2000)
2730  
-            self.assert_non_localized_year(url, 2003)
2731  
-            self.assert_non_localized_year(url, 2005)
  2728
+            self.assert_non_localized_year(response, 2000)
  2729
+            self.assert_non_localized_year(response, 2003)
  2730
+            self.assert_non_localized_year(response, 2005)

0 notes on commit 4e7c2ba

Please sign in to comment.
Something went wrong with that request. Please try again.