示例#1
0
def setarc(_resp, arc, origin_id, destination_id):
    arc_cls = all_arcs.get(arc)
    arc_count = Arc.query(Arc.origin == to_node_key(origin_id), Arc.destination == to_node_key(destination_id)).count()
    if arc_count > 0:
        _resp.write("Arc already exists")
    else:
        arc_cls(origin=to_node_key(origin_id), destination=to_node_key(destination_id)).put()
        _resp.write("Arc Created")
示例#2
0
 def assert_arc_creation(self, cmd, origin, destination):
     created_arc = cmd()
     self.assertEqual(to_node_key(origin), to_node_key(cmd.origin))
     self.assertEqual(to_node_key(destination), to_node_key(cmd.destination))
     arc = Arc.query().order(-Arc.creation).get()
     self.assertEqual(arc, created_arc)
     self.assertEqual(to_node_key(origin), to_node_key(arc.origin))
     self.assertEqual(to_node_key(destination), to_node_key(arc.destination))