diff options
| author | Robert Collins <robertc@robertcollins.net> | 2009-10-13 16:43:05 +1100 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2009-10-13 16:43:05 +1100 |
| commit | 1de9fa417f7e1bd7911fd6eeed08e35b6813b2cd (patch) | |
| tree | e5376e264ca95c82afc1dff257c8b90477fb9be8 /python/subunit/tests/test_details.py | |
| parent | 951351e835f299ce6d56bacdfceeebdb70032987 (diff) | |
| download | subunit-1de9fa417f7e1bd7911fd6eeed08e35b6813b2cd.tar.gz | |
Gather multipart details.
Diffstat (limited to 'python/subunit/tests/test_details.py')
| -rw-r--r-- | python/subunit/tests/test_details.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/python/subunit/tests/test_details.py b/python/subunit/tests/test_details.py index bc0930a..f76d505 100644 --- a/python/subunit/tests/test_details.py +++ b/python/subunit/tests/test_details.py @@ -18,7 +18,7 @@ from cStringIO import StringIO import unittest import subunit.tests -from subunit import details +from subunit import content, content_type, details def test_suite(): @@ -60,3 +60,21 @@ class TestMultipartDetails(unittest.TestCase): def test_get_details(self): parser = details.MultipartDetailsParser(None) self.assertEqual({}, parser.get_details()) + + def test_parts(self): + parser = details.MultipartDetailsParser(None) + parser.lineReceived("Content-Type: text/plain\n") + parser.lineReceived("something\n") + parser.lineReceived("F\r\n") + parser.lineReceived("serialised\n") + parser.lineReceived("form0\r\n") + expected = {} + expected['something'] = content.Content( + content_type.ContentType("text", "plain"), + lambda:["serialised\nform"]) + found = parser.get_details() + self.assertEqual(expected.keys(), found.keys()) + self.assertEqual(expected['something'].content_type, + found['something'].content_type) + self.assertEqual(''.join(expected['something'].iter_bytes()), + ''.join(found['something'].iter_bytes())) |
