Martin Czygan avatar Martin Czygan committed 5019212

api v2 rename

Comments (0)

Files changed (7)

 
 
 
-API v2
+API vX
 ------
 
 /pools
 
 Pools sind einfach. Zweifach geschachtelt.
 Man kann ein Exam erstellen. Dieses Exam muss einen Pool nutzen.
+
+
+API v2
+------

audrid/views/v2api/audits.py

 # GET /audits
 # GET /audits/<id>
 #
-@app.route('/api/v1/audits', methods=['GET'])
+@app.route('/api/v2/audits', methods=['GET'])
 @authorization_required
 def audits_get_all(user=None):
     """ Return all audits. """
     return jsonify(audits=[ a.as_dict() for a in Audit.query.all() ])
 
-@app.route('/api/v1/audits/<id>', methods=['GET'])
+@app.route('/api/v2/audits/<id>', methods=['GET'])
 @authorization_required
 def audits_get(id, user=None):
     """ Return all audits. """
 #
 # POST /audits
 #
-@app.route('/api/v1/audits', methods=['POST'])
+@app.route('/api/v2/audits', methods=['POST'])
 @authorization_required
 def audits_post(user=None):
     """ Create an audit. This will create a trial document as well. """
 #
 # PUT /audits/<id>
 #
-@app.route('/api/v1/audits/<id>', methods=['PUT'])
+@app.route('/api/v2/audits/<id>', methods=['PUT'])
 @authorization_required
 def audits_put(id, user=None):
     """ Update audit. """

audrid/views/v2api/exams.py

 # GET /exams
 # GET /exams/<id>
 #
-@app.route('/api/v1/exams', methods=['GET'])
+@app.route('/api/v2/exams', methods=['GET'])
 @authorization_required
 def exams_get_all(user=None):
     """ Return all exams. """
     return jsonify(exams=[ e.as_dict() for e in Exam.query.filter_by(deleted=False).all() ])
 
-@app.route('/api/v1/exams/<id>', methods=['GET'])
+@app.route('/api/v2/exams/<id>', methods=['GET'])
 @authorization_required
 def exams_get_one(user=None):
     """ Get one exam. """
 #
 # POST /exams
 #
-@app.route('/api/v1/exams', methods=['POST'])
+@app.route('/api/v2/exams', methods=['POST'])
 @authorization_required
 def exams_get_post(user=None):
     """ Return all exams. """
 #
 # DELETE /exams/<id>
 #
-@app.route('/api/v1/exams/<id>', methods=['DELETE'])
+@app.route('/api/v2/exams/<id>', methods=['DELETE'])
 @authorization_required
 def exams_delete_one(id, user=None):
     """ Delete one exam. """

audrid/views/v2api/pools.py

 # GET /pools/<id>/tasks
 # GET /pools/<pid>/tasks/<tid>
 #
-@app.route('/api/v1/pools', methods=['GET'])
+@app.route('/api/v2/pools', methods=['GET'])
 @authorization_required
 def pools_get_all(user=None):
     """
     pools = Pool.query.filter_by(deleted=False)
     return jsonify(pools=[ json.loads(p.body) for p in pools ])
 
-@app.route('/api/v1/pools/<id>', methods=['GET'])
+@app.route('/api/v2/pools/<id>', methods=['GET'])
 @authorization_required
 def pools_get(id, user=None):
     """
     pool = Pool.query.filter_by(deleted=False).filter_by(id=id).first_or_404()
     return jsonify(json.loads(pool.body))
 
-@app.route('/api/v1/pools/<id>/tasks', methods=['GET'])
+@app.route('/api/v2/pools/<id>/tasks', methods=['GET'])
 @authorization_required
 def pools_tasks_get_all(id, user=None):
     """
     pool = Pool.query.filter_by(deleted=False).filter_by(id=id).first_or_404()
     return jsonify(tasks=pool.tasks())
 
-@app.route('/api/v1/pools/<pid>/tasks/<tid>', methods=['GET'])
+@app.route('/api/v2/pools/<pid>/tasks/<tid>', methods=['GET'])
 @authorization_required
 def pools_tasks_get(pid, tid, user=None):
     """
         return jsonify(message='no such task: %s' % tid), 404
     return jsonify(task)
 
-@app.route('/api/v1/pools/<id>/versions', methods=['GET'])
+@app.route('/api/v2/pools/<id>/versions', methods=['GET'])
 @authorization_required
 def pools_versions_get_all(id, user=None):
     """
     pool_versions = PoolVersion.query.filter_by(id=id).order_by('version DESC').all()
     return jsonify(versions=[ pv.as_dict() for pv in pool_versions ])
 
-@app.route('/api/v1/pools/<id>/versions/<version>', methods=['GET'])
+@app.route('/api/v2/pools/<id>/versions/<version>', methods=['GET'])
 @authorization_required
 def pools_versions_get_one(id, version, user=None):
     """
 # POST /pools
 # POST /pools/<id>/tasks
 #
-@app.route('/api/v1/pools', methods=['POST'])
+@app.route('/api/v2/pools', methods=['POST'])
 @authorization_required
 def pools_post(user=None):
     """
         return jsonify(message='storage error: %s' % exc), 400
     return redirect(url_for('pools_get', id=pool.id))
 
-@app.route('/api/v1/pools/<id>/tasks', methods=['POST'])
+@app.route('/api/v2/pools/<id>/tasks', methods=['POST'])
 @authorization_required
 def pools_tasks_post(id, user=None):
     """
 # DELETE /pools/<id>/tasks
 # DELETE /pools/<pid>/tasks/<tid>
 #
-@app.route('/api/v1/pools/<pid>/tasks/<tid>', methods=['DELETE'])
+@app.route('/api/v2/pools/<pid>/tasks/<tid>', methods=['DELETE'])
 @authorization_required
 def pools_delete_tasks_one(pid, tid, user=None):
     """
         return jsonify(message='storage error: %s' % exc), 400        
     return jsonify(pool.as_dict())
 
-@app.route('/api/v1/pools/<id>/tasks', methods=['DELETE'])
+@app.route('/api/v2/pools/<id>/tasks', methods=['DELETE'])
 @authorization_required
 def pools_delete_tasks_all(id, user=None):
     """
         return jsonify(message='storage error: %s' % exc), 400        
     return jsonify(pool.as_dict())
 
-@app.route('/api/v1/pools/<id>', methods=['DELETE'])
+@app.route('/api/v2/pools/<id>', methods=['DELETE'])
 @authorization_required
 def pools_delete(id, user=None):
     """
         return jsonify(message='storage error: %s' % exc), 400        
     return jsonify({'id' : pool.id, 'deleted' : True})
 
-@app.route('/api/v1/pools', methods=['DELETE'])
+@app.route('/api/v2/pools', methods=['DELETE'])
 @authorization_required
 def pools_delete_all(user=None):
     """

tests/test_api_audits.py

 
     def test_audits_get_all_returns_200(self):
         """ GET    /audits should return 200 """
-        rv = self.open_with_auth('/api/v1/audits', method='GET')
+        rv = self.open_with_auth('/api/v2/audits', method='GET')
         self.assertEqual(200, rv.status_code)
 
     def test_audits_get_all_returns_correct_number(self):
         """ GET    /audits should return correct number of audits """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
 
-        rv = self.open_with_auth('/api/v1/audits', method='GET')
+        rv = self.open_with_auth('/api/v2/audits', method='GET')
         self.assertEqual(0, len(json.loads(rv.data).get('audits', [])))
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
 
-        rv = self.open_with_auth('/api/v1/audits', method='GET')
+        rv = self.open_with_auth('/api/v2/audits', method='GET')
         self.assertEqual(1, len(json.loads(rv.data).get('audits', [])))
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
 
-        rv = self.open_with_auth('/api/v1/audits', method='GET')
+        rv = self.open_with_auth('/api/v2/audits', method='GET')
         self.assertEqual(2, len(json.loads(rv.data).get('audits', [])))
 
     def test_audits_get_all_has_audits_key(self):
         """ GET    /audits returns dict with 'audits' key """
-        rv = self.open_with_auth('/api/v1/audits', method='GET')
+        rv = self.open_with_auth('/api/v2/audits', method='GET')
         self.assertTrue('audits' in json.loads(rv.data))
 
     def test_audits_get_one_throws_404_on_missing_audit(self):
         """ GET    /audits/<id> returns 404 on miss """
-        rv = self.open_with_auth('/api/v1/audits/123', method='GET')
+        rv = self.open_with_auth('/api/v2/audits/123', method='GET')
         self.assertEqual(404, rv.status_code)
 
     def test_audits_post_rejects_non_existing_exam_id(self):
         """ POST   /audits rejects non existent exam_id """
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({
             "exam_id" : 1123, "user_id" : 1 }))
         self.assertEqual(404, rv.status_code)
 
     def test_audits_post_rejects_non_existing_user_id(self):
         """ POST   /audits rejects non existent user_id """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({
             "exam_id" : 1, "user_id" : 123 }))
         self.assertEqual(404, rv.status_code)
 
     def test_audits_post_rejects_invalid_data(self):
         """ POST   /audits rejects invalid data """
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps("Hello"))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps("Hello"))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps([]))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps([]))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : "Hello World"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : "Hello World"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1.0}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1.0}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"user_id" : "Hello"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"user_id" : "Hello"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"user_id" : 1, "exam_id" : "nono"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"user_id" : 1, "exam_id" : "nono"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : "1", "user_id" : "2"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : "1", "user_id" : "2"}))
         self.assertEqual(400, rv.status_code)
 
     def test_audits_post_accepts_correct_data(self):
         """ POST   /audits accepts correct data """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
         self.assertEqual(200, rv.status_code)
 
     def test_audits_put_rejects_invalid_data(self):
         """ PUT    /audits rejects invalid data """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 2, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 2, "user_id" : 1}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 2}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({}))
         self.assertEqual(400, rv.status_code)
 
     def test_audits_put_rejects_invalid_status_transitions(self):
         """ PUT    /audits rejects invalid status transitions """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
         self.assertEqual(400, rv.status_code)
 
     def test_audits_put_accept_valid_status_transitions(self):
         """ PUT    /audits accepts valid status transitions """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
-        rv = self.open_with_auth('/api/v1/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "123"}))
+        rv = self.open_with_auth('/api/v2/audits', method='POST', data=json.dumps({"exam_id" : 1, "user_id" : 1}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "registered"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "registered"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "started"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "started"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "started"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "started"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "finished"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
+        rv = self.open_with_auth('/api/v2/audits/1', method='PUT', data=json.dumps({"exam_id" : 1, "user_id" : 1, "status" : "corrected"}))
         self.assertEqual(200, rv.status_code)

tests/test_api_exams.py

 
     def test_exam_post_rejects_invalid_data(self):
         """ POST   /exams should reject invalid data """
-        rv = self.open_with_auth('/api/v1/exams', method='POST')
+        rv = self.open_with_auth('/api/v2/exams', method='POST')
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"id" : 10}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"id" : 10}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps([]))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps([]))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps("Hello"))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps("Hello"))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"pool_id" : 1}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"pool_id" : 1}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "sample exam"}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "sample exam"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "", "pool_id" : "1"}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "", "pool_id" : "1"}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "12", "krakra" : 123}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "12", "krakra" : 123}))
         self.assertEqual(400, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps(
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps(
             {"name" : "test", "pool_id" : "12", "duration" : "hello" }))
         self.assertEqual(400, rv.status_code)
 
     def test_exam_post_fails_on_missing_pool(self):
         """ POST   /exams should fail if pool_id does not exist """
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps(
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps(
             {"name" : "iazsdu", "pool_id" : "12", "duration" : 50, "description" : "this is a sample test"}))
         self.assertEqual(404, rv.status_code)
 
     def test_exam_post_accept_valid_data(self):
         """ POST   /exams should accept valid data """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'12', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test-1", "pool_id" : "12"}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'12', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test-1", "pool_id" : "12"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps(
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps(
             {"name" : "test-2", "pool_id" : "12", "description" : "Hello World"}))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps(
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps(
             {"name" : "test-3", "pool_id" : "12", "duration" : 50, }))
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps(
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps(
             {"name" : "test-4", "pool_id" : "12", "duration" : 50, "description" : "this is a sample test"}))
         self.assertEqual(200, rv.status_code)
 
     def test_exam_get_all_200(self):
         """ GET    /exams should return 200 """
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(200, rv.status_code)
 
     def test_exam_get_all_is_empty(self):
         """ GET    /exams should return an 0-len list """
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(200, rv.status_code)
         self.assertEqual(0, len(json.loads(rv.data).get('exams', None)))
 
     def test_exam_get_all_correct_number_of_exams(self):
         """ GET    /exams should return the correct number of exams """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(200, rv.status_code)
         self.assertEqual(1, len(json.loads(rv.data).get('exams', None)))
 
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test-2", "pool_id" : "1234"}))
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test-2", "pool_id" : "1234"}))
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(200, rv.status_code)
         self.assertEqual(2, len(json.loads(rv.data).get('exams', None)))
 
     def test_exam_get_all_is_empty(self):
         """ DELETE /exams/<id> should set the deleted flag """
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(0, len(json.loads(rv.data).get('exams', None)))
 
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'1234', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/exams', method='POST', data=json.dumps({"name" : "test", "pool_id" : "1234"}))
         
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(1, len(json.loads(rv.data).get('exams', None)))
 
-        rv = self.open_with_auth('/api/v1/exams/1', method='DELETE')
-        rv = self.open_with_auth('/api/v1/exams', method='GET')
+        rv = self.open_with_auth('/api/v2/exams/1', method='DELETE')
+        rv = self.open_with_auth('/api/v2/exams', method='GET')
         self.assertEqual(0, len(json.loads(rv.data).get('exams', None)))
 

tests/test_api_pools.py

     def test_pools_post_reject_invalid_data(self):
         """ POST   /pools should reject invalid request data
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({}))
         self.assertEqual(400, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : 'x'}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : 'x'}))
         self.assertEqual(400, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : '123456'}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : '123456'}))
         self.assertEqual(400, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'tasks' : '123456'}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'tasks' : '123456'}))
         self.assertEqual(400, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'tasks' : []}))
         self.assertEqual(400, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'tasks' : ["Hello", "World"]}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'tasks' : ["Hello", "World"]}))
         self.assertEqual(400, rv.status_code)
 
     def test_pools_post_reject_duplicate_id(self):
         """ POST   /pools should reject duplicate pool id
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
         self.assertEqual(302, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
         self.assertEqual(400, rv.status_code)
 
     def test_pools_post(self):
         """ POST   /pools should accept valid request data 
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
         self.assertEqual(302, rv.status_code)
 
     def test_pools_get_all(self):
         """ GET    /pools should report correct number of pools
         """
-        rv = self.open_with_auth('/api/v1/pools', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='GET')
         self.assertEqual(0, len(json.loads(rv.data)['pools']))
 
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools', method='GET')
         self.assertEqual(1, len(json.loads(rv.data)['pools']))
 
     def test_pools_get_one_reject_invalid_id(self):
         """ GET    /pools/<id> should return 404 on unknown id
         """
-        rv = self.open_with_auth('/api/v1/pools/this_is_not_here', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/this_is_not_here', method='GET')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_get_one_returns_200_on_hit(self):
         """ GET    /pools/<id> should return 200 on hit
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools/123456', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools/123456', method='GET')
         self.assertEqual(200, rv.status_code)
 
     def test_pools_get_one_returns_pool_data(self):
         """ GET    /pools/<id> should return pool data on hit
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools/123456', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools/123456', method='GET')
         self.assertEqual('123456', json.loads(rv.data)['id'])
         self.assertEqual([], json.loads(rv.data)['tasks'])
         self.assertEqual(2, len(json.loads(rv.data).keys()))
     def test_pools_delete_returns_404_on_unknown_id(self):
         """ DELETE /pools/<id> returns 404 on unknown id
         """
-        rv = self.open_with_auth('/api/v1/pools/xxx', method='DELETE')
+        rv = self.open_with_auth('/api/v2/pools/xxx', method='DELETE')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_delete_actually_deletes(self):
         """ DELETE /pools/<id> sets deleted flag correctly
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools/123456', method='DELETE')
-        rv = self.open_with_auth('/api/v1/pools', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools/123456', method='DELETE')
+        rv = self.open_with_auth('/api/v2/pools', method='GET')
         self.assertEqual(0, len(json.loads(rv.data)['pools']))
 
     def test_pools_tasks_get_all_returns_404_on_missing_pool(self):
         """ GET    /pools/<id>/tasks returns 404 on missing pool
         """
-        rv = self.open_with_auth('/api/v1/pools/xxx/tasks', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/xxx/tasks', method='GET')
         self.assertEqual(404, rv.status_code)        
 
     def test_pools_tasks_get_all_returns_200_on_hit(self):
         """ GET    /pools/<id>/tasks returns 200 on hit
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='GET')
         self.assertEqual(200, rv.status_code)        
 
     def test_pools_tasks_get_all_returns_tasks_on_hit(self):
         """ GET    /pools/<id>/tasks returns tasks
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : []}))
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='GET')
         self.assertEqual(0, len(json.loads(rv.data)['tasks']))
 
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
             {'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}] }))
         self.assertEqual(302, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks', method='GET')
         self.assertEqual(1, len(json.loads(rv.data)['tasks']))
 
     def test_pools_tasks_get_one_returns_404_on_missing_pool(self):
         """ GET    /pools/<id>/tasks/<id> returns 404 on missing pool
         """
-        rv = self.open_with_auth('/api/v1/pools/xxx/tasks/yyy', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/xxx/tasks/yyy', method='GET')
         self.assertEqual(404, rv.status_code)        
 
     def test_pools_tasks_get_one_returns_404_on_missing_task(self):
         """ GET    /pools/<id>/tasks/<id> returns 404 on existing pool but missing task
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks/hellow', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks/hellow', method='GET')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_tasks_get_one_returns_200_on_hit(self):
         """ GET    /pools/<id>/tasks/<id> returns 200 on hit
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
             {'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}] }))
         self.assertEqual(302, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks/zzzxxx', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks/zzzxxx', method='GET')
         self.assertEqual(200, rv.status_code)
 
     def test_pools_tasks_get_one_returns_correct_task(self):
         """ GET    /pools/<id>/tasks/<id> returns correct task
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [
             {'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}] }))
         self.assertEqual(302, rv.status_code)
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks/zzzxxx', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks/zzzxxx', method='GET')
         self.assertEqual({'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}, 
             json.loads(rv.data))
 
     def test_pools_tasks_post_returns_404_on_missing_pool(self):
         """ POST   /pools/<id>/tasks returns 404 on missing pool
         """
-        rv = self.open_with_auth('/api/v1/pools/missing/tasks', method='POST')
+        rv = self.open_with_auth('/api/v2/pools/missing/tasks', method='POST')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_tasks_post_returns_200_on_correct_task(self):
         """ POST   /pools/<id>/tasks returns 200 on correct task
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}))
         self.assertEqual(200, rv.status_code)
 
     def test_pools_tasks_post_returns_200_on_correct_task(self):
         """ POST   /pools/<id>/tasks actually adds the task to the pool
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'zoo', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'zzzxxx', 'task' : 'Hello WOrld!', 'answer' : ''}))
 
         # one way to check ...
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks/zzzxxx', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks/zzzxxx', method='GET')
         self.assertEqual(200, rv.status_code)        
         # and another
-        rv = self.open_with_auth('/api/v1/pools/zoo/tasks', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/zoo/tasks', method='GET')
         self.assertEqual(1, len(json.loads(rv.data)['tasks']))
 
     def test_pools_delete(self):
         """ DELETE /pools should set the deleted flag on all pools
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'two', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'three', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'two', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'three', 'tasks' : [] }))
 
-        rv = self.open_with_auth('/api/v1/pools', method='DELETE')
+        rv = self.open_with_auth('/api/v2/pools', method='DELETE')
 
-        rv = self.open_with_auth('/api/v1/pools', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='GET')
         self.assertEqual(0, len(json.loads(rv.data)['pools']))
 
     def test_pools_post_deleted_id(self):
         """ POST   /pools should return 400 also when the existing pool is marked deleted
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools', method='DELETE')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools', method='DELETE')
         
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'one', 'tasks' : [] }))
         self.assertEqual(400, rv.status_code)        
 
     def test_pools_versions_returns_404_on_missing_pool(self):
         """ GET    /pools/<id>/versions return 404 on missing pool
         """
-        rv = self.open_with_auth('/api/v1/pools/xxx/versions', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/xxx/versions', method='GET')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_versions_returns_200_on_existing_pool(self):
         """ GET    /pools/<id>/versions return 200 on existing pool
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/123456/versions', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/123456/versions', method='GET')
         self.assertEqual(200, rv.status_code)
 
     def test_pools_versions_returns_versions(self):
         """ GET    /pools/<id>/versions return versions
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/123456/versions', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/123456/versions', method='GET')
         self.assertEqual(1, len(json.loads(rv.data).get('versions')))
 
     def test_pools_versions_returns_correct_number_ofversions(self):
         """ GET    /pools/<id>/versions returns correct number of versions
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'grammar1', 'task' : 'Hello WOrld!', 'answer' : ''}))
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions', method='GET')
         self.assertEqual(2, len(json.loads(rv.data).get('versions')))
 
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'grammar2', 'task' : 'Hello WOrld!', 'answer' : ''}))
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions', method='GET')
         self.assertEqual(3, len(json.loads(rv.data).get('versions')))
 
     def test_pools_versions_404_or_200_on_version_hit_or_miss(self):
         """ GET    /pools/<id>/versions/<version> returns 404 or 200 correctly
         """
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'grammar1', 'task' : 'Hello WOrld!', 'answer' : ''}))
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/1', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/1', method='GET')
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/2', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/2', method='GET')
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/3', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/3', method='GET')
         self.assertEqual(404, rv.status_code)
 
     def test_pools_versions_version_altering_operations(self):
         """ GET    /pools/<id>/versions/<version> correctly tracks operations (POST and DELETE)
         """
         # create a pool
-        rv = self.open_with_auth('/api/v1/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/1', method='GET')
+        rv = self.open_with_auth('/api/v2/pools', method='POST', data=json.dumps({'id' : u'123456', 'tasks' : [] }))
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/1', method='GET')
         self.assertEqual(200, rv.status_code)
 
         # add a task
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks', method='POST', 
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks', method='POST', 
             data=json.dumps({'kind' : 'text', 'id' : 'grammar1', 'task' : 'Hello WOrld!', 'answer' : ''}))
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/2', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/2', method='GET')
         self.assertEqual(200, rv.status_code)
 
         # delete a specific task
-        rv = self.open_with_auth('/api/v1/pools/123456/tasks/grammar1', method='DELETE')
+        rv = self.open_with_auth('/api/v2/pools/123456/tasks/grammar1', method='DELETE')
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/3', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/3', method='GET')
         self.assertEqual(200, rv.status_code)
 
-        rv = self.open_with_auth('/api/v1/pools/123456/versions/4', method='GET')
+        rv = self.open_with_auth('/api/v2/pools/123456/versions/4', method='GET')
         self.assertEqual(404, rv.status_code)
 
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.