def test_json_import(self): self.Persons.delete() self.Addresses.delete() self.Towns.delete() json_connector = JsonDBConnector(self.db) init_dump = '{"addresses": [{"_uuid_": "7b6e18c4-4259-4da3-b44c-cb335e9d0929", "street": "Baker st.", "town": "d2d3f8df-8ce5-40b0-8183-38084b198dc7"}], "persons": [{"_uuid_": "efc1ec5a-0ef3-4881-870a-bdf69651d7ff", "address": "7b6e18c4-4259-4da3-b44c-cb335e9d0929", "age": "35", "custno": 0, "name": "Sherlock Holmes"}], "towns": [{"_uuid_": "d2d3f8df-8ce5-40b0-8183-38084b198dc7", "name": "London"}]}' json_connector.import_dump(init_dump) p1 = list(self.Persons.get(name="Sherlock Holmes"))[0] a1 = list(self.Addresses.get(street="Baker st."))[0] t1 = list(self.Towns.get(name="London"))[0] assert p1.address is a1 assert a1.town is t1
def test_json_export(self): self.Persons(age=35, name="Sherlock Holmes", address=self.Addresses(street="Baker st.", town=self.Towns(name="London"))) json_connector = JsonDBConnector(self.db) dump = json_connector.export_dump() assert dump