def test_save_timer(self):
     dao = TimerDAO()
     t1 = TimerEntity(notes="My Test LegacyTimer Running!",
                      user=TestObjects().get_test_user(),
                      running=True)
     dao.put(t1)
     assert (t1.id is not None)
Exemple #2
0
 def post(self):
     api_v1_root = '/api/v1'
     timer = TimerFormatter().dict_to_model(TimerEntity, request.json)
     dao = TimerDAO()
     dao.put(timer)
     id = str(timer.id)
     resp = jsonify(dict(id=id))
     resp.headers["Location"] = self.make_location(request.url, id)
     resp.status_code = http.client.CREATED
     return resp
 def post(self):
     api_v1_root = '/api/v1'
     timer = TimerFormatter().dict_to_model(TimerEntity, request.json)
     dao = TimerDAO()
     dao.put(timer)
     id = str(timer.id)
     resp = jsonify(dict(id=id))
     resp.headers["Location"] = self.make_location(request.url, id)
     resp.status_code = http.client.CREATED
     return resp
Exemple #4
0
 def put(self, id):
     #api_v1_root = '/api/v1'
     timer_new = TimerFormatter().dict_to_model(TimerEntity, request.json)
     dao = TimerDAO()
     timer = dao.get(id)
     if timer is not None:
         timer.update_attributes(timer_new)
         dao.put(timer)
         id = str(timer.id)
         resp = jsonify(dict(id=id))
         #resp.headers["Location"] = api_v1_root + self.root + "/" + id
         resp.headers["Location"] = self.make_location(request.url, id)
         resp.status_code = http.client.OK
         return resp
 def put(self, id):
     #api_v1_root = '/api/v1'
     timer_new = TimerFormatter().dict_to_model(TimerEntity, request.json)
     dao = TimerDAO()
     timer = dao.get(id)
     if timer is not None:
         timer.update_attributes(timer_new)
         dao.put(timer)
         id = str(timer.id)
         resp = jsonify(dict(id=id))
         #resp.headers["Location"] = api_v1_root + self.root + "/" + id
         resp.headers["Location"] = self.make_location(request.url, id)
         resp.status_code = http.client.OK
         return resp
 def test_save_timer(self):
     dao = TimerDAO()
     t1 = Timer(notes="My Test LegacyTimer Running!", user=TestObjects().get_test_user(), running=True)
     dao.put(t1)
     assert(t1.id is not None)