def setUp(self): self.vertices = VertexProxy(Vertex, self.client) self.edges = EdgeProxy(Edge, self.client) self.james = self.vertices.create({'name': 'James'}) self.julie = self.vertices.create({'name': 'Julie'}) self.edges.create(self.james, "test", self.julie) self.edges.create(self.julie, "test", self.james)
def setUp(self): self.vertices = VertexProxy(Vertex,self.resource) self.edges = EdgeProxy(Edge,self.resource) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'}) assert isinstance(self.james,Vertex) self.edges.create(self.james,"test",self.julie) self.edges.create(self.julie,"test",self.james)
def setUp(self): self.vertices = VertexProxy(Vertex,self.client) self.edges = EdgeProxy(Edge,self.client) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'}) self.edges.create(self.james,"test",self.julie) self.edges.create(self.julie,"test",self.james)
def __init__(self, root_uri=SAIL_URI): self.config = Config(root_uri) self.resource = RexsterResource(self.config) # No indices on sail graphs self.gremlin = Gremlin(self.resource) self.vertices = VertexProxy(Vertex, self.resource) self.edges = EdgeProxy(Edge, self.resource)
def setUp(self): self.indicesV = VertexIndexProxy(self.index_class, self.client) self.indicesE = EdgeIndexProxy(self.index_class, self.client) self.indicesV.delete("test_idxV") self.indicesE.delete("test_idxE") self.vertices = VertexProxy(Vertex, self.client) self.vertices.index = self.indicesV.get_or_create("test_idxV") self.edges = EdgeProxy(Edge, self.client) self.edges.index = self.indicesE.get_or_create("test_idxE")
def __init__(self, root_uri=REXSTER_URI): self.config = Config(root_uri) self.resource = RexsterResource(self.config) self.gremlin = Gremlin(self.resource) self.indices = IndexProxy(RexsterIndex, resource) self.vertices = VertexProxy(Vertex, self.resource) self.vertices.index = self.indices.get("vertices", Vertex) self.edges = EdgeProxy(Edge, self.resource) self.edges.index = self.indices.get("edges", Edge)
class VertexTestCase(BulbsTestCase): def setUp(self): self.vertices = VertexProxy(Vertex,self.client) self.edges = EdgeProxy(Edge,self.client) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'}) self.edges.create(self.james,"test",self.julie) self.edges.create(self.julie,"test",self.james) def test_init(self): #assert type(self.james._id) == int assert isinstance(self.james,Vertex) assert self.james._type == "vertex" assert self.james.name == "James" assert self.julie._type == "vertex" assert self.julie.name == "Julie" def test_get_out_edges(self): edges = self.james.outE() edges = list(edges) assert len(edges) == 1 def test_get_in_edges(self): edges = self.james.inE() edges = list(edges) assert len(edges) == 1 def test_get_both_edges(self): edges = self.james.bothE() edges = list(edges) assert len(edges) == 2 def test_get_both_labeled_edges(self): edges = self.james.bothE("test") edges = list(edges) assert len(edges) == 2
def setUp(self): self.indicesV = VertexIndexProxy(self.index_class,self.resource) self.indicesE = EdgeIndexProxy(self.index_class,self.resource) #self.indicesV.delete("edges") #self.indicesE.delete("edges") self.vertices = VertexProxy(Vertex,self.resource) self.vertices.index = self.indicesV.get_or_create("vertices") self.edges = EdgeProxy(Edge,self.resource) self.edges.index = self.indicesE.get_or_create("edges")
class EdgeProxyTestCase(BulbsTestCase): def setUp(self): self.vertices = VertexProxy(Vertex,self.client) self.edges = EdgeProxy(Edge,self.client) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'}) def test_create(self): data = dict(timestamp=int(time.time())) edge = self.edges.create(self.james, "test", self.julie, data) assert edge._outV == self.james._id assert edge._label == "test" assert edge._inV == self.julie._id def test_update_and_get(self): now = int(time.time()) e1 = self.edges.create(self.james,"test",self.julie, {'timestamp': now}) assert e1.timestamp == now later = int(time.time()) self.edges.update(e1._id, {'timestamp': later}) e2 = self.edges.get(e1._id) assert e1._id == e2._id assert e1._inV == e2._inV assert e1._label == e2._label assert e1._outV == e2._outV assert e2.timestamp == later #def test_get_all(self): # edges = self.edges.get_all() # edges = list(edges) # assert type(edges) == list #def test_remove_property(self): # e1 = self.edges.create(self.james,"test",self.julie,{'time':'today'}) # query_time = self.edges.remove(e1._id,{'time'}) # assert type(query_time) == float # assert e1.time is None def test_delete_edge(self): e1 = self.edges.create(self.james,"test",self.julie) resp = self.edges.delete(e1._id) e2 = self.edges.get(e1._id) assert e2 == None
def __init__(self, root_uri=NEO4J_URI): self.config = Config(root_uri) self.resource = Neo4jResource(self.config) self.gremlin = Gremlin(self.resource) self.indicesV = VertexIndexProxy(ExactIndex, self.resource) self.indicesE = EdgeIndexProxy(ExactIndex, self.resource) # What happens if these REST calls error on Heroku? self.vertices = VertexProxy(Vertex, self.resource) self.vertices.index = self.indicesV.get_or_create("vertices") self.edges = EdgeProxy(Edge, self.resource) self.edges.index = self.indicesE.get_or_create("edges")
class EdgeProxyTestCase(BulbsTestCase): def setUp(self): self.vertices = VertexProxy(Vertex,self.resource) self.edges = EdgeProxy(Edge,self.resource) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'}) def test_create(self): edge = self.edges.create(self.james,"test",self.julie) assert edge._outV == self.james._id assert edge._label == "test" assert edge._inV == self.julie._id def test_update_and_get(self): e1 = self.edges.create(self.james,"test",self.julie,{'time':'today'}) assert e1.time == 'today' self.edges.update(e1._id,{'time':'tomorrow'}) e2 = self.edges.get(e1._id) assert e1._id == e2._id assert e1._inV == e2._inV assert e1._label == e2._label assert e1._outV == e2._outV assert e2.time == 'tomorrow' #def test_get_all(self): # edges = self.edges.get_all() # edges = list(edges) # assert type(edges) == list #def test_remove_property(self): # e1 = self.edges.create(self.james,"test",self.julie,{'time':'today'}) # query_time = self.edges.remove(e1._id,{'time'}) # assert type(query_time) == float # assert e1.time is None def test_delete_edge(self): e1 = self.edges.create(self.james,"test",self.julie) resp = self.edges.delete(e1._id) e2 = self.edges.get(e1._id) assert e2 == None
def setUp(self): self.vertices = VertexProxy(Vertex,self.resource) self.edges = EdgeProxy(Edge,self.resource) self.james = self.vertices.create({'name':'James'}) self.julie = self.vertices.create({'name':'Julie'})