mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 13:54:47 +03:00
Adding test for hyperlink
This commit is contained in:
parent
a827e63bc4
commit
93d81b5b74
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.test import TestCase
|
||||
|
||||
from rest_framework.relations import Hyperlink
|
||||
from rest_framework.templatetags.rest_framework import (
|
||||
add_nested_class, add_query_param, format_value, urlize_quoted_links
|
||||
)
|
||||
|
@ -30,6 +31,12 @@ class TemplateTagTests(TestCase):
|
|||
self.assertEqual(format_value(False), '<code>false</code>')
|
||||
self.assertEqual(format_value(None), '<code>null</code>')
|
||||
|
||||
def test_format_value_hyperlink(self):
|
||||
url = 'http://url.com'
|
||||
name = 'name_of_url'
|
||||
hyperlink = Hyperlink(url, name)
|
||||
self.assertEqual(format_value(hyperlink), '<a href=%s>%s</a>' % (url, name))
|
||||
|
||||
def test_format_value_list(self):
|
||||
"""
|
||||
Tests format_value with a list of strings
|
||||
|
|
Loading…
Reference in New Issue
Block a user