def test_has_relationship_should_add_subgraph_supplied_as_subgraph_defining_relationship(self): self.g.from_url('http://localhost', discard=['nonsense'], data_found_at='data').create_or_update(StubModel(), {}, {}) subgraph = OperationGraph.using('test', 'password').from_url("http://localhost").create_or_update(StubModel(), {}, {}) self.g.has_relationship('some_relationship', subgraph_defining_relationship = subgraph) current = self.g.current self.assertEquals('some_relationship', current.children[0].end_node._has_relationship)
def test_has_relationship_should_clear_all_current_variables(self): self.g.from_url('http://localhost', discard=['nonsense'], data_found_at='data').create_or_update(StubModel(), {}, {}) subgraph = OperationGraph.using('test', 'password').from_url("http://localhost").create_or_update(StubModel(), {}, {}) self.g.has_relationship('relationship', subgraph) self.assertTrue(self.g._informer is None) self.assertTrue(self.g._data_sanitizer is None)
def test_has_relationship_should_throw_exception_root_is_none(self): subgraph = OperationGraph.using('test', 'password').from_url("http://localhost") with self.assertRaises(AssertionError): self.g.has_relationship('relationship', subgraph)
def test_has_relationship_should_create_child_to_curent(self): self.g.from_url('http://localhost', discard=['nonsense'], data_found_at='data').create_or_update(StubModel(), {}, {}) subgraph = OperationGraph.using('test', 'password').from_url("http://localhost").create_or_update(StubModel(), {}, {}) self.g.has_relationship('relationship', subgraph) current = self.g.current self.assertEquals(subgraph.root, current.children[0].end_node)
def setUp(self): self.g = OperationGraph.using('test', 'password')