def test_data_no_type(self, client: HiroClient, vertex_data: Optional[VERTEX_T]): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex = graph.vertex.create(vertex_data) assert isinstance(vertex, Vertex) vertex.delete() pass
def test_vertex_create_model(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex_type = OgitEntity.OGIT_COMMENT res = graph.vertex.create(vertex_type) assert isinstance(res, Vertex) pass
def test_xid(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex_id = ExternalVertexId('arago.co') res = graph.vertex.get(vertex_id) assert isinstance(res, Vertex) pass
def test_upcast(self, client: HiroClient, vertex_type: VERTEX_TYPE_T, cls: Type[VERTEX_T_co]): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) res = graph.vertex.create(vertex_type) assert isinstance(res, cls) res.delete() pass
def test_ts(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) res = graph.vertex.create(OgitEntity.OGIT_TIME_SERIES) assert isinstance(res, TimeSeriesVertex) res.delete() pass
def test_vertex_delete_model(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) comment_v = graph.vertex.create(OgitEntity.OGIT_COMMENT) res = graph.vertex.delete(comment_v) assert isinstance(res, Vertex) pass
def test_type_no_data(self, client: HiroClient, vertex_type: VERTEX_TYPE_T): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex = graph.vertex.create(vertex_type) assert isinstance(vertex, Vertex) vertex.delete() pass
def test_str(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex_id = OgitEntity.OGIT_COMMENT.value.name.uri res = graph.vertex.get(vertex_id) assert isinstance(res, Vertex) pass
def test_blob_ontology(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) res = graph.vertex.create(OgitEntity.OGIT_ATTACHMENT.value) assert isinstance(res, BlobVertex) res.delete() pass
def test_edge_create_model(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) vertex_a = graph.vertex.create(OgitEntity.OGIT_ATTACHMENT) vertex_b = graph.vertex.create(OgitEntity.OGIT_COMMENT) res = graph.edge.create(vertex_a, OgitVerb.OGIT_BELONGS, vertex_b) isinstance(res, Edge) pass
def test_vertex_delete_data(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphData graph_m = Hiro6GraphModel(client) graph = Hiro6GraphData(client) comment_v = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) res = graph.vertex.delete(comment_v.id) assert isinstance(res, dict) pass
def test_blob_ogit_v(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel graph = Hiro6GraphModel(client) res = graph.vertex.create(OgitEntity.OGIT_ATTACHMENT, Vertex({ OgitAttribute.OGIT_NAME: 'foo' })) assert isinstance(res, BlobVertex) assert res[OgitAttribute.OGIT_NAME] == 'foo' res.delete() pass
def test_vertex_history_model_element(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel res_1 = client.root.model.search.index(rf'''ogit\/_type:"{OgitEntity.OGIT_LICENSE_REQUEST.value.name.uri!s}"''') vertex = next(res_1) graph = Hiro6GraphModel(client) res_2 = graph.vertex.history(vertex, res_format=HistoryFormat.ELEMENT) assert isinstance(res_2, Generator) vertex = next(res_2) assert isinstance(vertex, Vertex) pass
def test_vertex_delete_rest(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphRest graph_m = Hiro6GraphModel(client) graph = Hiro6GraphRest(client) comment_v = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) res = graph.vertex.delete(comment_v.id) res.raise_for_status() assert isinstance(res, Response) pass
def test_edge_create_data(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphData graph_m = Hiro6GraphModel(client) graph = Hiro6GraphData(client) vertex_a = graph_m.vertex.create(OgitEntity.OGIT_ATTACHMENT) vertex_b = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) edge_type = OgitVerb.OGIT_BELONGS.value.name.uri res = graph.edge.create(vertex_a.id, edge_type, vertex_b.id) isinstance(res, dict) pass
def test_edge_delete_data(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphData graph_m = Hiro6GraphModel(client) graph = Hiro6GraphData(client) vertex_a = graph_m.vertex.create(OgitEntity.OGIT_ATTACHMENT) vertex_b = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) edge_c = graph_m.edge.create(vertex_a, OgitVerb.OGIT_BELONGS, vertex_b) res = graph.edge.delete(edge_c.id) isinstance(res, dict) pass
def test_edge_delete_rest(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphRest graph_m = Hiro6GraphModel(client) graph = Hiro6GraphRest(client) vertex_a = graph_m.vertex.create(OgitEntity.OGIT_ATTACHMENT) vertex_b = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) edge_c = graph_m.edge.create(vertex_a, OgitVerb.OGIT_BELONGS, vertex_b) res = graph.edge.delete(edge_c.id) res.raise_for_status() isinstance(res, Response) pass
def test_vertex_history_model_diff(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel res_1 = client.root.model.search.index(rf'''ogit\/_type:"{OgitEntity.OGIT_LICENSE_REQUEST.value.name.uri!s}"''') vertex = next(res_1) graph = Hiro6GraphModel(client) res_2 = graph.vertex.history(vertex, res_format=HistoryFormat.DIFF) assert isinstance(res_2, Generator) diff = next(res_2) diff = next(res_2) assert isinstance(diff, HistoryDiff) replaced = diff.replaced assert isinstance(replaced, MappingProxyType) keys = iter(replaced) key = next(keys) assert isinstance(key, Attribute) pass
def test_edge_create_rest(self, client: HiroClient): from arago.hiro.backend.six.graph import Hiro6GraphModel from arago.hiro.backend.six.graph import Hiro6GraphRest graph_m = Hiro6GraphModel(client) graph = Hiro6GraphRest(client) vertex_a = graph_m.vertex.create(OgitEntity.OGIT_ATTACHMENT) vertex_b = graph_m.vertex.create(OgitEntity.OGIT_COMMENT) req_data = { 'out': str(vertex_a.id), 'in': str(vertex_b.id), } edge_type = OgitVerb.OGIT_BELONGS.value.name.uri res = graph.edge.create(edge_type, req_data) res.raise_for_status() isinstance(res, Response) pass