Beispiel #1
0
 def _delete(self, user):
     url = reverse('api:project_single_observation',
                   kwargs={
                       'project_id': self.project.id,
                       'observation_id': self.observation.id
                   })
     request = self.factory.delete(url, content_type='application/json')
     force_authenticate(request, user=user)
     view = SingleAllContributionAPIView.as_view()
     return view(request,
                 project_id=self.project.id,
                 observation_id=self.observation.id).render()
Beispiel #2
0
 def _delete(self, user):
     url = reverse(
         'api:project_single_observation',
         kwargs={
             'project_id': self.project.id,
             'observation_id': self.observation.id
         }
     )
     request = self.factory.delete(url, content_type='application/json')
     force_authenticate(request, user=user)
     view = SingleAllContributionAPIView.as_view()
     return view(
         request, project_id=self.project.id,
         observation_id=self.observation.id).render()
Beispiel #3
0
 def test_api_with_admin(self):
     CommentFactory.create_batch(5, **{'commentto': self.observation})
     factory = APIRequestFactory()
     url = reverse('api:project_single_observation',
                   kwargs={
                       'project_id': self.project.id,
                       'observation_id': self.observation.id
                   })
     request = factory.get(url)
     force_authenticate(request, user=self.admin)
     theview = SingleAllContributionAPIView.as_view()
     response = theview(request,
                        project_id=self.project.id,
                        observation_id=self.observation.id).render()
     self.assertEqual(response.status_code, 200)
Beispiel #4
0
 def test_api_with_admin(self):
     CommentFactory.create_batch(5, **{'commentto': self.observation})
     factory = APIRequestFactory()
     url = reverse('api:project_single_observation', kwargs={
         'project_id': self.project.id,
         'observation_id': self.observation.id
     })
     request = factory.get(url)
     force_authenticate(request, user=self.admin)
     theview = SingleAllContributionAPIView.as_view()
     response = theview(
         request,
         project_id=self.project.id,
         observation_id=self.observation.id).render()
     self.assertEqual(response.status_code, 200)