Ejemplo n.º 1
0
 def test_get_details_success(self):
     parser = details.SimpleDetailsParser(None)
     traceback = ""
     expected = {}
     expected['message'] = content.Content(
         content_type.ContentType("text", "plain"), lambda: [""])
     found = parser.get_details("success")
     self.assertEqual(expected, found)
Ejemplo n.º 2
0
 def test_get_details_skip(self):
     parser = details.SimpleDetailsParser(None)
     traceback = ""
     expected = {}
     expected['reason'] = content.Content(
         content_type.ContentType("text", "plain"),
         lambda:[_b("")])
     found = parser.get_details("skip")
     self.assertEqual(expected, found)
Ejemplo n.º 3
0
 def test_get_details(self):
     parser = details.SimpleDetailsParser(None)
     traceback = ""
     expected = {}
     expected['traceback'] = content.Content(
         content_type.ContentType("text", "x-traceback",
                                  {'charset': 'utf8'}), lambda: [""])
     found = parser.get_details()
     self.assertEqual(expected.keys(), found.keys())
     self.assertEqual(expected['traceback'].content_type,
                      found['traceback'].content_type)
     self.assertEqual(''.join(expected['traceback'].iter_bytes()),
                      ''.join(found['traceback'].iter_bytes()))
Ejemplo n.º 4
0
 def test_parts(self):
     parser = details.MultipartDetailsParser(None)
     parser.lineReceived(_b("Content-Type: text/plain\n"))
     parser.lineReceived(_b("something\n"))
     parser.lineReceived(_b("F\r\n"))
     parser.lineReceived(_b("serialised\n"))
     parser.lineReceived(_b("form0\r\n"))
     expected = {}
     expected['something'] = content.Content(
         content_type.ContentType("text", "plain"),
         lambda:[_b("serialised\nform")])
     found = parser.get_details()
     self.assertEqual(expected.keys(), found.keys())
     self.assertEqual(expected['something'].content_type,
         found['something'].content_type)
     self.assertEqual(_b('').join(expected['something'].iter_bytes()),
         _b('').join(found['something'].iter_bytes()))