Esempio n. 1
0
    def test_encode_decode_multipart(self):
        initial_text = 'some dummy data to check encoding and decoding'
        encoded = Util.encode_multipart(initial_text)
        decoded = Util.decode_multipart(encoded)

        self.assertTrue(len(encoded) > 0)
        self.assertTrue(len(decoded) > 0)
        self.assertEqual(initial_text, decoded)
Esempio n. 2
0
    def test_encode_decode_multipart_as_json(self):
        initial_text = 'some dummy data to check encoding and decoding'
        dsmode = 'local'
        encoded = Util.encode_multipart(initial_text)
        decoded = Util.decode_multipart_as_json(dsmode, encoded)

        json_data = json.loads(decoded)

        self.assertTrue(len(encoded) > 0)
        self.assertTrue(len(decoded) > 0)
        self.assertEqual(initial_text, json_data['user-data'])
        self.assertEqual(dsmode, json_data['dsmode'])