Example #1
0
    def testSerialization(self):
        d = Device('a', 'abcdefgh', True)
        p = Person('A', [d])

        person_json = ('{"name": "A", "devices": [' +
                       '{"is_wireless": true, "status": "offline", ' +
                       '"mac": "abcdefgh", "name": "a"}]}')
        self.assertEqual(json_encode(p), person_json)
Example #2
0
 def to_json(self):
     return json_encode(self.serialize())
Example #3
0
 def to_json(self):
     #  return json.dumps(self.serialize())
     return json_encode(self.serialize())