summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_widgets
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2010-09-11 18:38:24 +0000
committerJustin Bronn <jbronn@gmail.com>2010-09-11 18:38:24 +0000
commite4bd5e8a2d3442205cd292fe534d109777b55a7a (patch)
treea782163c7f06a0fcc490cd2600deb8a242b92dda /tests/regressiontests/admin_widgets
parentf4ebd701f239d4392ba8409125406eca514cbfb5 (diff)
[1.2.X] Fixed #13149 -- The admin `ForeignKeyRawIdWidget` now properly handles non-integer values. Thanks, Chris Adams.
Backport of r13751 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_widgets')
-rw-r--r--tests/regressiontests/admin_widgets/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_widgets/tests.py b/tests/regressiontests/admin_widgets/tests.py
index fd0c25ca1a..c445644335 100644
--- a/tests/regressiontests/admin_widgets/tests.py
+++ b/tests/regressiontests/admin_widgets/tests.py
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
from django import forms
from django.contrib import admin
from django.contrib.admin import widgets
@@ -151,3 +153,13 @@ class AdminForeignKeyRawIdWidget(DjangoTestCase):
post_data)
self.assertContains(response,
'Select a valid choice. That choice is not one of the available choices.')
+
+ def test_invalid_target_id(self):
+
+ for test_str in ('Iñtërnâtiônàlizætiøn', "1234'", -1234):
+ # This should result in an error message, not a server exception.
+ response = self.client.post('%s/admin_widgets/event/add/' % self.admin_root,
+ {"band": test_str})
+
+ self.assertContains(response,
+ 'Select a valid choice. That choice is not one of the available choices.')