def test_add_cat_obj_with_expired_token(self): num_of_obj = self.get_num_of_obj(self.list_url) response = self.add_obj( url=self.list_url, data=self.data, token=get_expired_token_key(), ) self.assertEqual( response.status_code, status.HTTP_401_UNAUTHORIZED, "#TCV-A02: Able to add cat object with expired token") new_num_of_obj = self.get_num_of_obj(self.list_url) self.assertEqual( new_num_of_obj, num_of_obj, "#TCV-A02: Invalid object is accidentally added to total count")
def test_remove_cat_obj_with_expired_token(self): cat_obj = self.create_cat_obj() num_of_obj = self.get_num_of_obj(self.list_url) response = self.remove_obj( url=self.detail_url, data=self.data, pk=cat_obj.pk, token=get_expired_token_key(), ) self.assertEqual( response.status_code, status.HTTP_401_UNAUTHORIZED, "#TCV-D02: Able to remove cat object with expired token") new_num_of_obj = self.get_num_of_obj(self.list_url) self.assertEqual( new_num_of_obj, num_of_obj, "#TCV-D02: Total count of Cat object is unexpectedly reduced")