Example #1
0
 def test_put_details_endpoint(self):
     new_commitment_dict = self.commitment_dict
     new_description = 'NEW DESCRIPTION YO'
     new_commitment_dict['description'] = new_description
     request = self.factory.put('/profile/commitments/' + str(self.id_to_check), new_commitment_dict)
     force_authenticate(request, user=self.user)
     response = views.commitments_detail(request, pk=self.id_to_check)
     self.assertEqual(response.data['id'], self.id_to_check)
Example #2
0
 def test_get_details_endpoint(self):
     request2 = self.factory.get('/profile/commitments/' + str(self.id_to_check))
     force_authenticate(request2, user=self.user)
     response2 = views.commitments_detail(request2, pk=self.id_to_check)
     self.assertEqual(response2.status_code, status.HTTP_200_OK)
     self.assertEqual(response2.data['id'], self.id_to_check)
Example #3
0
 def test_delete_details_endpoint(self):
     request_delete = self.factory.delete('/profile/commitments/' + str(self.id_to_check))
     force_authenticate(request_delete, user=self.user)
     response = views.commitments_detail(request_delete, pk=self.id_to_check)
     self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)