def testGet(self): todo1 = {'title': 'test1', 'order': 1, 'completed': False} key = Todo(**todo1).put() todo1['id'] = key.id() request = webapp2.Request.blank('/api/todos') response = request.get_response(main.app) self.assertEqual([todo1], json.loads(response.body))
def testGet(self): todo1 = { 'title': 'test1', 'order': 1, 'completed': False } key = Todo(**todo1).put() todo1['id'] = key.id() request = webapp2.Request.blank('/api/todos') response = request.get_response(main.app) self.assertEqual([todo1], json.loads(response.body))
def post(self): j = json.loads(self.request.body) key = Todo(**j).put() self.response.out.write(json.dumps({'id': key.id()}))