aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTom Christie2014-12-03 23:24:32 +0000
committerTom Christie2014-12-03 23:24:32 +0000
commit5e6052811716a494e995a84c497579867ee6acaa (patch)
treeee3b2a12ee552daac3a49862ae2fc6e934975b34 /tests
parentcd4d8660211e7af3b06986b68a9281be0b8ffacf (diff)
parent3d6620c72a9cbaedecc37cc76e591a79409de305 (diff)
downloaddjango-rest-framework-5e6052811716a494e995a84c497579867ee6acaa.tar.bz2
Merge branch 'jpadilla-yaml' into version-3.1
Diffstat (limited to 'tests')
-rw-r--r--tests/test_renderers.py53
-rw-r--r--tests/test_templatetags.py13
2 files changed, 2 insertions, 64 deletions
diff --git a/tests/test_renderers.py b/tests/test_renderers.py
index eb163ea5..2c8da2dc 100644
--- a/tests/test_renderers.py
+++ b/tests/test_renderers.py
@@ -9,11 +9,9 @@ from django.test import TestCase
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from rest_framework import status, permissions
-from rest_framework.compat import yaml, BytesIO
from rest_framework.response import Response
from rest_framework.views import APIView
-from rest_framework.renderers import BaseRenderer, JSONRenderer, YAMLRenderer, BrowsableAPIRenderer
-from rest_framework.parsers import YAMLParser
+from rest_framework.renderers import BaseRenderer, JSONRenderer, BrowsableAPIRenderer
from rest_framework.settings import api_settings
from rest_framework.test import APIRequestFactory
from collections import MutableMapping
@@ -394,55 +392,6 @@ class AsciiJSONRendererTests(TestCase):
self.assertEqual(content, '{"countries":["United Kingdom","France","Espa\\u00f1a"]}'.encode('utf-8'))
-if yaml:
- _yaml_repr = 'foo: [bar, baz]\n'
-
- class YAMLRendererTests(TestCase):
- """
- Tests specific to the YAML Renderer
- """
-
- def test_render(self):
- """
- Test basic YAML rendering.
- """
- obj = {'foo': ['bar', 'baz']}
- renderer = YAMLRenderer()
- content = renderer.render(obj, 'application/yaml')
- self.assertEqual(content.decode('utf-8'), _yaml_repr)
-
- def test_render_and_parse(self):
- """
- Test rendering and then parsing returns the original object.
- IE obj -> render -> parse -> obj.
- """
- obj = {'foo': ['bar', 'baz']}
-
- renderer = YAMLRenderer()
- parser = YAMLParser()
-
- content = renderer.render(obj, 'application/yaml')
- data = parser.parse(BytesIO(content))
- self.assertEqual(obj, data)
-
- def test_render_decimal(self):
- """
- Test YAML decimal rendering.
- """
- renderer = YAMLRenderer()
- content = renderer.render({'field': Decimal('111.2')}, 'application/yaml')
- self.assertYAMLContains(content.decode('utf-8'), "field: '111.2'")
-
- def assertYAMLContains(self, content, string):
- self.assertTrue(string in content, '%r not in %r' % (string, content))
-
- def test_proper_encoding(self):
- obj = {'countries': ['United Kingdom', 'France', 'España']}
- renderer = YAMLRenderer()
- content = renderer.render(obj, 'application/yaml')
- self.assertEqual(content.strip(), 'countries: [United Kingdom, France, España]'.encode('utf-8'))
-
-
# Tests for caching issue, #346
class CacheRenderTest(TestCase):
"""
diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py
index b04a937e..0cee91f1 100644
--- a/tests/test_templatetags.py
+++ b/tests/test_templatetags.py
@@ -54,7 +54,7 @@ class Issue1386Tests(TestCase):
class URLizerTests(TestCase):
"""
- Test if both JSON and YAML URLs are transformed into links well
+ Test if JSON URLs are transformed into links well
"""
def _urlize_dict_check(self, data):
"""
@@ -73,14 +73,3 @@ class URLizerTests(TestCase):
data['"foo_set": [\n "http://api/foos/1/"\n], '] = \
'&quot;foo_set&quot;: [\n &quot;<a href="http://api/foos/1/">http://api/foos/1/</a>&quot;\n], '
self._urlize_dict_check(data)
-
- def test_yaml_with_url(self):
- """
- Test if YAML URLs are transformed into links well
- """
- data = {}
- data['''{users: 'http://api/users/'}'''] = \
- '''{users: &#39;<a href="http://api/users/">http://api/users/</a>&#39;}'''
- data['''foo_set: ['http://api/foos/1/']'''] = \
- '''foo_set: [&#39;<a href="http://api/foos/1/">http://api/foos/1/</a>&#39;]'''
- self._urlize_dict_check(data)