Beispiel #1
0
 def test_post(self):
     self.giveUser()
     me = User.ensure_current()
     self.assertEquals(0, Reflect.count_for(me))
     request = webapp2.Request.blank('/reflect', POST='{"note":"Hello","source":"http://google.com/"}')
     request.method = "PUT"
     request.content_type = "application/json"
     response = request.get_response(main.app)
     self.assertEquals(response.status_int, 200)
     self.assertEquals(1, Reflect.count_for(me))
     json.loads(response.body)        
Beispiel #2
0
    def test_delete(self):
        self.giveUser()
        me = User.ensure_current()
        toput = Reflect(parent=me, source="http://example.com", note="Hello")
        toput.put()
        self.assertEquals(1, Reflect.count_for(me))

        request = webapp2.Request.blank('/reflect?id=%s' % str(toput.key()))
        request.method = "DELETE"
        response = request.get_response(main.app)
        self.assertEquals(response.status_int, 200)
        self.assertEquals(0, Reflect.count_for(me))
        json.loads(response.body)