Esempio n. 1
0
 def _test_post(self):
     """PlacesListView should return nearby places when point is given."""
     PlaceFactory()
     data = {'lat': 1.3568494, 'lng': 103.9478796}
     req = RequestFactory().post(self.get_url(), data=data)
     resp = PlaceListView().dispatch(req)
     self.assertEqual(len(resp.context_data['places']), 1)
Esempio n. 2
0
 def _test_post_no_places(self):
     """PlacesListView should return [] when no places exist."""
     req = RequestFactory().post(self.get_url(), data={'lat': 1, 'lng': 2})
     resp = PlaceListView().dispatch(req)
     self.assertEqual(resp.context_data['places'], [])