def test_get_draft_object_with_admin(self): self.observation.status = 'draft' self.observation.save() view = SingleAllContributionAPIView() view.get_object(self.admin, self.observation.project.id, self.observation.id)
def test_get_draft_object_with_admin(self): self.observation.status = 'draft' self.observation.save() view = SingleAllContributionAPIView() view.get_object( self.admin, self.observation.project.id, self.observation.id)
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()
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()
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)
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)
def test_get_object_with_some_dude(self): some_dude = UserF.create() view = SingleAllContributionAPIView() view.get_object(some_dude, self.observation.project.id, self.observation.id)
def test_get_object_with_admin(self): view = SingleAllContributionAPIView() observation = view.get_object(self.admin, self.observation.project.id, self.observation.id) self.assertEqual(observation, self.observation)
def test_get_object_with_creator(self): view = SingleAllContributionAPIView() view.get_object(self.creator, self.observation.project.id, self.observation.id)
def test_get_object_with_some_dude(self): some_dude = UserF.create() view = SingleAllContributionAPIView() view.get_object( some_dude, self.observation.project.id, self.observation.id)
def test_get_object_with_admin(self): view = SingleAllContributionAPIView() observation = view.get_object( self.admin, self.observation.project.id, self.observation.id) self.assertEqual(observation, self.observation)
def test_get_object_with_creator(self): view = SingleAllContributionAPIView() view.get_object( self.creator, self.observation.project.id, self.observation.id)