Commits

Ronny Pfannschmidt committed 5384837

turn GET /pullxjob to POST /pull for now

  • Participants
  • Parent commits e0ea4f4

Comments (0)

Files changed (5)

tests/mocksupport.py

         return x
 
 class MockConnGet:
+    hostspec = '<testing>'
     def __init__(self, url, data):
         self._url = url
         self._data = data
         return MockResponse(200, self._data)
 
 class MockConnPost:
+    hostspec = '<testing>'
     def __init__(self, url, responsedata, status=201):
         self._url = url
         self._responsedata = responsedata

tests/test_server.py

 
 def test_pullxjob(app):
     xjobid = test_submitxjob(app)
-    r = app.get("/pullxjob")
+    r = app.post("/pull")
     res = json.loads(r.data)
     assert res['xjobid'] == xjobid
     return xjobid

tests/test_slave.py

 from mocksupport import MockConnPost, MockConnGet
         
 def test_pullxjob_nojob():
-    conn = MockConnGet("/pullxjob", json_encode({'xjobid':'no'}))
+    conn = MockConnPost("/pull", json_encode({'xjobid':'no'}))
     r = slave.pullxjob(conn)
     assert r is None
 
 def test_pullxjob():
     xjobspec = XJobSpec(args="123".split())
     data = dict(xjobid=1, spec=xjobspec)
-    conn = MockConnGet("/pullxjob", json_encode(data))
+    conn = MockConnPost("/pull", json_encode(data))
     r = slave.pullxjob(conn)
     assert r is not None
     assert r.xjobid == 1
     }
     return json_response(app, **xjobs)
 
-@app.route("/pullxjob", methods=["GET"])
+@app.route("/pull", methods=["POST"])
 def pullxjob():
     xjobid = app.xjobstorage.pull()
     if xjobid is not None:
 def pullxjob(conn):
     log("pullxjob: initiating request")
     try:
-        response = conn.GET("/pullxjob")
+        response = conn.POST("/pull")
     except:
         log("[WARN] server %s does not seem to be online" % conn.hostspec)
         return None