def testPost2(self): #courier not found order = Order(orderId=1,pickup_lat=1.0,pickup_lon=1.0,dropoff_lat=2.0,dropoff_lon=2.0) order.put() courier = Courier(courierId=1,lat=2.0,lon=3.0,orderId=1) courier.put() self.assertEqual(1,len(Courier.all().fetch(20))) # if the courier is not found, nothing should be changed response = self.testapp.post('/courier/2/complete') self.assertEqual(333,response.status_int)
def testInsertCourier(self): #create courier and there are no orders awaiting pickup params = {'id': 1, 'lat': 1.0,'lon':2.0} response = self.testapp.post('/courier/new', params) self.assertEqual(302,response.status_int) p2 = {'id': 2, 'lat': 11.0,'lon':22.0} response = self.testapp.post('/courier/new', p2) self.assertEqual(302,response.status_int) self.assertEqual(2, len(Courier.all().fetch(20))) courier = db.GqlQuery("SELECT * FROM Courier WHERE courierId = 1").get() self.assertNotEqual(None, courier)