class TestSaveIndexed(object): @pytest.fixture(autouse=True) def setup(self, graph): self.graph = graph try: self.graph.legacy.delete_index(Node, "People") except LookupError: pass self.store = Store(self.graph) def test_can_save(self): alice = Person("*****@*****.**", "Alice Smith", 34) bob = Person("*****@*****.**", "Bob Smith", 66) self.store.save_indexed("People", "family_name", "Smith", alice, bob) people = self.graph.legacy.get_index(Node, "People") smiths = people.get("family_name", "Smith") assert len(smiths) == 2 assert alice.__node__ in smiths assert bob.__node__ in smiths carol = Person("*****@*****.**", "Carol Smith", 42) self.store.save_indexed("People", "family_name", "Smith", carol) smiths = people.get("family_name", "Smith") assert len(smiths) == 3 assert alice.__node__ in smiths assert bob.__node__ in smiths assert carol.__node__ in smiths