Пример #1
0
 def _get(self, user):
     url = reverse('api:project_locations',
                   kwargs={'project_id': self.project.id})
     request = self.factory.get(url)
     force_authenticate(request, user=user)
     view = LocationsAPIView.as_view()
     return view(request, project_id=self.project.id).render()
Пример #2
0
    def test_park(self):
        request = self.factory.get(self.url + '?query=park')
        force_authenticate(request, user=self.project.creator)
        view = LocationsAPIView.as_view()
        response = view(request, project_id=self.project.id).render()

        response_json = json.loads(response.content)
        self.assertEqual(len(response_json.get('features')), 3)
        self.assertNotIn('"description": "hyde"', response.content.decode())
Пример #3
0
    def test_hyd(self):
        request = self.factory.get(self.url + '?query=Hyd')
        force_authenticate(request, user=self.project.creator)
        view = LocationsAPIView.as_view()
        response = view(request, project_id=self.project.id).render()

        response_json = json.loads(response.content)
        self.assertEqual(len(response_json.get('features')), 3)
        self.assertNotIn('Regents Park', response.content.decode())
Пример #4
0
    def test_park(self):
        request = self.factory.get(self.url + '?query=park')
        force_authenticate(request, user=self.project.creator)
        view = LocationsAPIView.as_view()
        response = view(request, project_id=self.project.id).render()

        response_json = json.loads(response.content)
        self.assertEqual(len(response_json.get('features')), 3)
        self.assertNotIn('"description": "hyde"', response.content)
Пример #5
0
 def _get(self, user):
     url = reverse(
         'api:project_locations',
         kwargs={
             'project_id': self.project.id
         }
     )
     request = self.factory.get(url)
     force_authenticate(request, user=user)
     view = LocationsAPIView.as_view()
     return view(request, project_id=self.project.id).render()