Пример #1
0
    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))
Пример #2
0
    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))
Пример #3
0
    def post(self):
        j = json.loads(self.request.body)
        key = Todo(**j).put()

        self.response.out.write(json.dumps({'id': key.id()}))
Пример #4
0
    def post(self):
        j = json.loads(self.request.body)
        key = Todo(**j).put()

        self.response.out.write(json.dumps({'id': key.id()}))