def test_from_json_dict_no_address(self): person_json = { "id": 1, "last_name": "Alpha", "email": "*****@*****.**", "middles": "NMI", "first_name": "Adam" } p = Person() p.from_json(person_json) expected = self.create_person() expected.address = None self.assertEqual(expected, p)
def test_from_json_dict(self): person_json = { "id": 1, "address": { "country": "Paradise", "street": "123 Main St", "city": "Eden", "post_code": "1", "state": "Garden" }, "last_name": "Alpha", "email": "*****@*****.**", "middles": "NMI", "first_name": "Adam" } p = Person() p.from_json(person_json) expected = self.create_person() self.assertEqual(expected, p)