diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-01-08 02:09:20 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-01-16 19:53:49 +1300 |
commit | 28577aae928847e64a0274b5922e26e1f15d9916 (patch) | |
tree | 78f6b36e8166d3320120df0e1bc91fef7ce8f9b1 /lib/subunit/python/testtools/tests/test_content_type.py | |
parent | b6b46b4978dcaffa0cd9803c43b8a5f1c19e227e (diff) | |
download | samba-28577aae928847e64a0274b5922e26e1f15d9916.tar.gz samba-28577aae928847e64a0274b5922e26e1f15d9916.tar.bz2 samba-28577aae928847e64a0274b5922e26e1f15d9916.zip |
Import testtools as well, required for subunit.
Diffstat (limited to 'lib/subunit/python/testtools/tests/test_content_type.py')
-rw-r--r-- | lib/subunit/python/testtools/tests/test_content_type.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/subunit/python/testtools/tests/test_content_type.py b/lib/subunit/python/testtools/tests/test_content_type.py new file mode 100644 index 0000000000..dbefc21dec --- /dev/null +++ b/lib/subunit/python/testtools/tests/test_content_type.py @@ -0,0 +1,34 @@ +# Copyright (c) 2008 Jonathan M. Lange. See LICENSE for details. + +import unittest +from testtools.content_type import ContentType + + +def test_suite(): + from unittest import TestLoader + return TestLoader().loadTestsFromName(__name__) + + +class TestContentType(unittest.TestCase): + + def test___init___None_errors(self): + self.assertRaises(ValueError, ContentType, None, None) + self.assertRaises(ValueError, ContentType, None, "traceback") + self.assertRaises(ValueError, ContentType, "text", None) + + def test___init___sets_ivars(self): + content_type = ContentType("foo", "bar") + self.assertEqual("foo", content_type.type) + self.assertEqual("bar", content_type.subtype) + self.assertEqual({}, content_type.parameters) + + def test___init___with_parameters(self): + content_type = ContentType("foo", "bar", {"quux":"thing"}) + self.assertEqual({"quux":"thing"}, content_type.parameters) + + def test___eq__(self): + content_type1 = ContentType("foo", "bar", {"quux":"thing"}) + content_type2 = ContentType("foo", "bar", {"quux":"thing"}) + content_type3 = ContentType("foo", "bar", {"quux":"thing2"}) + self.assertTrue(content_type1.__eq__(content_type2)) + self.assertFalse(content_type1.__eq__(content_type3)) |