예제 #1
0
 def test_json_codec(self):
     mime_codec = MimeCodec()
     mime = 'application/json'
     value = dict(key='value')
     data = '{"key": "value"}'
     self.assertEqual(data, mime_codec.marshal(mime, value))
     self.assertEqual(value, mime_codec.unmarshal(mime, data))
예제 #2
0
 def test_plain_codec(self):
     mime_codec = MimeCodec()
     mime = 'text/plain'
     text = 'plain text'
     self.assertEqual(text, mime_codec.marshal(mime, text))
     self.assertEqual(text, mime_codec.unmarshal(mime, text))