Commits

Ronny Pfannschmidt committed 5384837

turn GET /pullxjob to POST /pull for now

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.