Commits

Ronny Pfannschmidt  committed 63eea6c

turn around result url

  • Participants
  • Parent commits 270d106

Comments (0)

Files changed (4)

File tests/test_server.py

     result = XResult(xjobid, "out", "err", 0)
     rv = app.post("/result", data=json_encode(result))
     assert rv.data == "Thanks."
-    r = app.get("/getresult/%s" % xjobid)
+    r = app.get("/%s/result" % xjobid)
     result2 = XResult.from_json(json.loads(r.data)['result'])
     assert result2.out == result.out
     assert result2.err == result.err
 
 @py.test.mark.xfail(reason='unfinished')
 def test_result_without_job(app):
-    r = app.get('/getresult', data=json_encode({'xjobid': 1}))
+    r = app.get('/1/result')
     assert r.status == 404
     #XXX: finish

File xnet/conn.py

             hostspec = "localhost:%s" % defaults.server_port
         self.hostspec = hostspec
         self.conn = httplib.HTTPConnection(hostspec)
-    
+
     def GET(self, url, body=None, headers={}):
         self.conn.request("GET", url, body, headers)
         response = self.conn.getresponse()

File xnet/server.py

     app.logger.info("added result %s" % result)
     return text_response(app, "Thanks.")
 
-@app.route("/getstdout/<int:xjobid>", methods=['GET'])
+@app.route("/<int:xjobid>/stdout", methods=['GET'])
 def getstdout(xjobid):
     stdout = app.streamh.get_stdout(xjobid)
     if stdout is None:
                     response[key] = value.rstrip('\n')
         return json_response(app, xjobid=xjobid, stdout=response)
 
-@app.route("/getresult/<int:xjobid>", methods=['GET'])
+@app.route("/<int:xjobid>/result", methods=['GET'])
 def getresult(xjobid):
     result = app.resultstorage.get(xjobid=xjobid)
     app.logger.info("returning result %s" % result)

File xnet/tool.py

     return xjoblist
 
 def getresultinfo(conn, xjobid):
-    response = conn.GET("/getresult/" + str(xjobid))
+    response = conn.GET("/%s/result" % xjobid)
     content = response.read()
     data = json.loads(content)
     result = XResult.from_json(data['result'])