Commit 8043ff3f by Artem Muterko Committed by Tom Christie

Add test for urlquote_wrapper (#4832)

parent e21afbe7
...@@ -4,6 +4,7 @@ from __future__ import unicode_literals ...@@ -4,6 +4,7 @@ from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from rest_framework.relations import Hyperlink from rest_framework.relations import Hyperlink
from rest_framework.templatetags import rest_framework
from rest_framework.templatetags.rest_framework import ( from rest_framework.templatetags.rest_framework import (
add_nested_class, add_query_param, as_string, break_long_headers, add_nested_class, add_query_param, as_string, break_long_headers,
format_value, get_pagination_html, urlize_quoted_links format_value, get_pagination_html, urlize_quoted_links
...@@ -268,6 +269,15 @@ class Issue1386Tests(TestCase): ...@@ -268,6 +269,15 @@ class Issue1386Tests(TestCase):
# example from issue #1386, this shouldn't raise an exception # example from issue #1386, this shouldn't raise an exception
urlize_quoted_links("asdf:[/p]zxcv.com") urlize_quoted_links("asdf:[/p]zxcv.com")
def test_smart_urlquote_wrapper_handles_value_error(self):
def mock_smart_urlquote(url):
raise ValueError
old = rest_framework.smart_urlquote
rest_framework.smart_urlquote = mock_smart_urlquote
assert rest_framework.smart_urlquote_wrapper('test') is None
rest_framework.smart_urlquote = old
class URLizerTests(TestCase): class URLizerTests(TestCase):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment