summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-02-15 20:42:57 +0000
committerJannis Leidel <jannis@leidel.info>2011-02-15 20:42:57 +0000
commit551da285db768364e9111e6ad0ec368b63bb8377 (patch)
treea3f9bdc606050835d33d7ab9f1b299f71025add2
parentfe21117cc3d5349aff6a1bb57ac768ef05967577 (diff)
[1.2.X] Moved the test added in r15511 to a different test where it doesn't actually verify the existence of the URL by calling urlopen but only validates it.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/forms/tests/fields.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py
index a9272bed2a..17879399b1 100644
--- a/tests/regressiontests/forms/tests/fields.py
+++ b/tests/regressiontests/forms/tests/fields.py
@@ -28,6 +28,7 @@ import datetime
import time
import re
import os
+import urllib2
from decimal import Decimal
from unittest import TestCase
@@ -567,8 +568,6 @@ class FieldsTests(TestCase):
f.clean('http://google.com/we-love-microsoft.html') # good domain, bad page
except ValidationError, e:
self.assertEqual("[u'This URL appears to be a broken link.']", str(e))
- # UTF-8 char in path
- self.assertEqual(u'http://de.wikipedia.org/wiki/T\xfcr', f.clean(u'http://de.wikipedia.org/wiki/T\xfcr'))
def test_urlfield_4(self):
f = URLField(verify_exists=True, required=False)
@@ -622,6 +621,18 @@ class FieldsTests(TestCase):
except ValidationError, e:
self.assertEqual("[u'This URL appears to be a broken link.']", str(e))
+ def test_urlfield_10(self):
+ # UTF-8 char in path, enclosed by a monkey-patch to make sure it
+ # the encoding is passed to urllib2.urlopen
+ f = URLField(verify_exists=True)
+ try:
+ _orig_urlopen = urllib2.urlopen
+ urllib2.urlopen = lambda req: True
+ url = u'http://t\xfcr.djangoproject.com/'
+ self.assertEqual(url, f.clean(url))
+ finally:
+ urllib2.urlopen = _orig_urlopen
+
# BooleanField ################################################################
def test_booleanfield_1(self):