diff --git a/intervention/tests/test_views.py b/intervention/tests/test_views.py index e552dbe6..5cc5fb8f 100644 --- a/intervention/tests/test_views.py +++ b/intervention/tests/test_views.py @@ -36,6 +36,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.run_check_url = reverse("intervention:check", args=(self.intervention.id,)) self.record_url = reverse("intervention:record", args=(self.intervention.id,)) self.report_url = reverse("intervention:report", args=(self.intervention.id,)) + self.compensation_remove_url = reverse("intervention:remove-compensation", args=(self.compensation.intervention.id, self.compensation.id)) self.deduction.intervention = self.intervention self.deduction.save() @@ -83,6 +84,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.revocation_new_url: f"{login_redirect_base}{self.revocation_new_url}", self.revocation_edit_url: f"{login_redirect_base}{self.revocation_edit_url}", self.revocation_remove_url: f"{login_redirect_base}{self.revocation_remove_url}", + self.compensation_remove_url: f"{login_redirect_base}{self.compensation_remove_url}", } self.assert_url_success(client, success_urls) @@ -124,6 +126,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] self.assert_url_success(client, success_urls) @@ -162,6 +165,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] fail_urls = [ self.run_check_url, @@ -212,6 +216,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] success_urls_redirect = { self.share_url: self.detail_url @@ -258,6 +263,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] success_urls_redirect = { self.share_url: self.detail_url @@ -304,6 +310,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] success_urls_redirect = { self.share_url: self.detail_url @@ -350,6 +357,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] success_urls_redirect = { self.share_url: self.detail_url @@ -396,6 +404,7 @@ class InterventionViewTestCase(BaseViewTestCase): self.deduction_new_url, self.deduction_edit_url, self.deduction_remove_url, + self.compensation_remove_url, ] # Define urls where a redirect to a specific location is the proper response success_urls_redirect = { diff --git a/intervention/views/compensation.py b/intervention/views/compensation.py index b8516d38..40469a17 100644 --- a/intervention/views/compensation.py +++ b/intervention/views/compensation.py @@ -14,7 +14,7 @@ from django.utils.decorators import method_decorator from django.views import View from intervention.models import Intervention -from konova.decorators import shared_access_required +from konova.decorators import shared_access_required, default_group_required from konova.forms.modals import RemoveModalForm from konova.utils.message_templates import COMPENSATION_REMOVED_TEMPLATE @@ -45,10 +45,12 @@ class RemoveCompensationFromInterventionView(LoginRequiredMixin, View): redirect_url=reverse("intervention:detail", args=(id,)) + "#related_data", ) + @method_decorator(default_group_required) @method_decorator(shared_access_required(Intervention, "id")) def get(self, request, id: str, comp_id: str, *args, **kwargs) -> HttpResponse: return self.__process_request(request, id, comp_id, *args, **kwargs) + @method_decorator(default_group_required) @method_decorator(shared_access_required(Intervention, "id")) def post(self, request, id: str, comp_id: str, *args, **kwargs) -> HttpResponse: return self.__process_request(request, id, comp_id, *args, **kwargs) \ No newline at end of file