aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests
diff options
context:
space:
mode:
authorTom Christie2014-02-13 16:27:19 +0000
committerTom Christie2014-02-13 16:27:19 +0000
commita06252f8125591c199443cce8b101aaa8f7f881e (patch)
tree24fb5d10c14a40758af6bbd15e1f29464b355e9e /rest_framework/tests
parent69b8ec4ebd741f84c74026dff56441ee7bb56df6 (diff)
parentdbd993d108b51bebbf9fd8d567d1c782cf941404 (diff)
downloaddjango-rest-framework-a06252f8125591c199443cce8b101aaa8f7f881e.tar.bz2
Merge pull request #1397 from amezhenin/issue_1386
update regex for matching URLs, fixes issue #1386
Diffstat (limited to 'rest_framework/tests')
-rw-r--r--rest_framework/tests/test_templatetags.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/rest_framework/tests/test_templatetags.py b/rest_framework/tests/test_templatetags.py
index 609a9e08..d4da0c23 100644
--- a/rest_framework/tests/test_templatetags.py
+++ b/rest_framework/tests/test_templatetags.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.test import TestCase
from rest_framework.test import APIRequestFactory
-from rest_framework.templatetags.rest_framework import add_query_param
+from rest_framework.templatetags.rest_framework import add_query_param, urlize_quoted_links
factory = APIRequestFactory()
@@ -17,3 +17,35 @@ class TemplateTagTests(TestCase):
json_url = add_query_param(request, "format", "json")
self.assertIn("q=%E6%9F%A5%E8%AF%A2", json_url)
self.assertIn("format=json", json_url)
+
+
+class Issue1386Tests(TestCase):
+ """
+ Covers #1386
+ """
+
+ def test_issue_1386(self):
+ """
+ Test function urlize_quoted_links with different args
+ """
+ correct_urls = [
+ "asdf.com",
+ "asdf.net",
+ "www.as_df.org",
+ "as.d8f.ghj8.gov",
+ ]
+ for i in correct_urls:
+ res = urlize_quoted_links(i)
+ self.assertNotEqual(res, i)
+ self.assertIn(i, res)
+
+ incorrect_urls = [
+ "mailto://asdf@fdf.com",
+ "asdf.netnet",
+ ]
+ for i in incorrect_urls:
+ res = urlize_quoted_links(i)
+ self.assertEqual(i, res)
+
+ # example from issue #1386, this shouldn't raise an exception
+ _ = urlize_quoted_links("asdf:[/p]zxcv.com")