예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
 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
예제 #12
0
 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
예제 #13
0
 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
예제 #14
0
 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
예제 #15
0
 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
예제 #16
0
 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
예제 #17
0
 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
예제 #18
0
 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
예제 #19
0
 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