summaryrefslogtreecommitdiff
path: root/lib/testtools/testtools/tests/test_content_type.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/testtools/testtools/tests/test_content_type.py')
-rw-r--r--lib/testtools/testtools/tests/test_content_type.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/testtools/testtools/tests/test_content_type.py b/lib/testtools/testtools/tests/test_content_type.py
index 9d8c0f6f7a..ecb8e3a72e 100644
--- a/lib/testtools/testtools/tests/test_content_type.py
+++ b/lib/testtools/testtools/tests/test_content_type.py
@@ -1,8 +1,12 @@
-# Copyright (c) 2008 testtools developers. See LICENSE for details.
+# Copyright (c) 2008, 2012 testtools developers. See LICENSE for details.
from testtools import TestCase
from testtools.matchers import Equals, MatchesException, Raises
-from testtools.content_type import ContentType, UTF8_TEXT
+from testtools.content_type import (
+ ContentType,
+ JSON,
+ UTF8_TEXT,
+ )
class TestContentType(TestCase):
@@ -39,7 +43,7 @@ class TestContentType(TestCase):
content_type = ContentType(
'text', 'plain', {'foo': 'bar', 'baz': 'qux'})
self.assertThat(
- repr(content_type), Equals('text/plain; foo="bar", baz="qux"'))
+ repr(content_type), Equals('text/plain; baz="qux", foo="bar"'))
class TestBuiltinContentTypes(TestCase):
@@ -50,6 +54,12 @@ class TestBuiltinContentTypes(TestCase):
self.assertThat(UTF8_TEXT.subtype, Equals('plain'))
self.assertThat(UTF8_TEXT.parameters, Equals({'charset': 'utf8'}))
+ def test_json_content(self):
+ # The JSON content type represents implictly UTF-8 application/json.
+ self.assertThat(JSON.type, Equals('application'))
+ self.assertThat(JSON.subtype, Equals('json'))
+ self.assertThat(JSON.parameters, Equals({}))
+
def test_suite():
from unittest import TestLoader