aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJosé Padilla2014-11-29 14:43:05 -0400
committerJosé Padilla2014-11-29 14:43:05 -0400
commit731c8421afe3093a78cdabb9c3cc28fa52cd1c8e (patch)
treebcbcfcfb32d0ab0e59605a5564cf320913767d6d /tests
parent3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff)
downloaddjango-rest-framework-731c8421afe3093a78cdabb9c3cc28fa52cd1c8e.tar.bz2
Remove YAML support from core
Diffstat (limited to 'tests')
-rw-r--r--tests/test_renderers.py57
-rw-r--r--tests/test_templatetags.py13
2 files changed, 5 insertions, 65 deletions
diff --git a/tests/test_renderers.py b/tests/test_renderers.py
index 416d7f22..0603f800 100644
--- a/tests/test_renderers.py
+++ b/tests/test_renderers.py
@@ -9,12 +9,12 @@ from django.test import TestCase
from django.utils import six, unittest
from django.utils.translation import ugettext_lazy as _
from rest_framework import status, permissions
-from rest_framework.compat import yaml, etree, StringIO, BytesIO
+from rest_framework.compat import etree, StringIO
from rest_framework.response import Response
from rest_framework.views import APIView
-from rest_framework.renderers import BaseRenderer, JSONRenderer, YAMLRenderer, \
- XMLRenderer, JSONPRenderer, BrowsableAPIRenderer
-from rest_framework.parsers import YAMLParser, XMLParser
+from rest_framework.renderers import BaseRenderer, JSONRenderer, XMLRenderer, \
+ JSONPRenderer, BrowsableAPIRenderer
+from rest_framework.parsers import XMLParser
from rest_framework.settings import api_settings
from rest_framework.test import APIRequestFactory
from collections import MutableMapping
@@ -452,55 +452,6 @@ class JSONPRendererTests(TestCase):
)
-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'))
-
-
class XMLRendererTestCase(TestCase):
"""
Tests specific to the XML Renderer
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)