Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.0.X] Fixed import statement in admin_views test to work with Pytho…

…n 2.3.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10790 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 985c939dd0031ced6a96bfbf2dc3cdeb7544fe0d 1 parent 55f1c3e
@mboersma mboersma authored
Showing with 13 additions and 14 deletions.
  1. +13 −14 tests/regressiontests/admin_views/tests.py
View
27 tests/regressiontests/admin_views/tests.py
@@ -12,10 +12,9 @@
from django.utils.html import escape
# local test models
-from models import (Article, BarAccount, CustomArticle, EmptyModel,
- FooAccount, Gallery, ModelWithStringPrimaryKey,
- Person, Persona, Picture, Section,
- Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit)
+from models import Article, BarAccount, CustomArticle, EmptyModel, \
+ FooAccount, Gallery, ModelWithStringPrimaryKey, Person, Persona, Picture, \
+ Section, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit
try:
set
@@ -231,20 +230,20 @@ def testNamedGroupFieldChoicesFilter(self):
class SaveAsTests(TestCase):
fixtures = ['admin-views-users.xml','admin-views-person.xml']
-
+
def setUp(self):
self.client.login(username='super', password='secret')
def tearDown(self):
self.client.logout()
-
+
def test_save_as_duplication(self):
"""Ensure save as actually creates a new person"""
post_data = {'_saveasnew':'', 'name':'John M', 'gender':1}
response = self.client.post('/test_admin/admin/admin_views/person/1/', post_data)
self.assertEqual(len(Person.objects.filter(name='John M')), 1)
self.assertEqual(len(Person.objects.filter(id=1)), 1)
-
+
def test_save_as_display(self):
"""
Ensure that 'save as' is displayed when activated and after submitting
@@ -1173,11 +1172,11 @@ def test_char_pk_inline(self):
self.failUnlessEqual(response.status_code, 302)
self.failUnlessEqual(DooHickey.objects.count(), 1)
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
-
+
# Check that the PK link exists on the rendered form
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
self.assertContains(response, 'name="doohickey_set-0-code"')
-
+
# Now resave that inline
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
self.post_data['doohickey_set-0-code'] = "DH1"
@@ -1186,7 +1185,7 @@ def test_char_pk_inline(self):
self.failUnlessEqual(response.status_code, 302)
self.failUnlessEqual(DooHickey.objects.count(), 1)
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
-
+
# Now modify that inline
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
self.post_data['doohickey_set-0-code'] = "DH1"
@@ -1195,7 +1194,7 @@ def test_char_pk_inline(self):
self.failUnlessEqual(response.status_code, 302)
self.failUnlessEqual(DooHickey.objects.count(), 1)
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1 Updated")
-
+
def test_integer_pk_inline(self):
"A model with an integer PK can be saved as inlines. Regression for #10992"
# First add a new inline
@@ -1205,11 +1204,11 @@ def test_integer_pk_inline(self):
self.failUnlessEqual(response.status_code, 302)
self.failUnlessEqual(Whatsit.objects.count(), 1)
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
-
+
# Check that the PK link exists on the rendered form
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
self.assertContains(response, 'name="whatsit_set-0-index"')
-
+
# Now resave that inline
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
self.post_data['whatsit_set-0-index'] = "42"
@@ -1218,7 +1217,7 @@ def test_integer_pk_inline(self):
self.failUnlessEqual(response.status_code, 302)
self.failUnlessEqual(Whatsit.objects.count(), 1)
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
-
+
# Now modify that inline
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
self.post_data['whatsit_set-0-index'] = "42"
Please sign in to comment.
Something went wrong with that request. Please try again.