86_User_suggestions_and_feedback #111
@ -10,6 +10,7 @@ from django.test import Client
|
||||
from django.contrib.auth.models import Group
|
||||
from django.urls import reverse
|
||||
|
||||
from intervention.models import Revocation
|
||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||
from konova.tests.test_views import BaseViewTestCase
|
||||
|
||||
@ -34,6 +35,17 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
cls.record_url = reverse("intervention:record", args=(cls.intervention.id,))
|
||||
cls.report_url = reverse("intervention:report", args=(cls.intervention.id,))
|
||||
|
||||
cls.deduction.intervention = cls.intervention
|
||||
cls.deduction.save()
|
||||
cls.deduction_new_url = reverse("intervention:new-deduction", args=(cls.intervention.id,))
|
||||
cls.deduction_remove_url = reverse("intervention:remove-deduction", args=(cls.intervention.id, cls.deduction.id))
|
||||
|
||||
cls.revocation = Revocation.objects.create(
|
||||
legal=cls.intervention.legal
|
||||
)
|
||||
cls.revocation_new_url = reverse("intervention:new-revocation", args=(cls.intervention.id,))
|
||||
cls.revocation_remove_url = reverse("intervention:remove-revocation", args=(cls.intervention.id, cls.revocation.id))
|
||||
|
||||
def test_views_anonymous_user(self):
|
||||
""" Check correct status code for all requests
|
||||
|
||||
@ -61,6 +73,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.share_create_url: f"{login_redirect_base}{self.share_create_url}",
|
||||
self.run_check_url: f"{login_redirect_base}{self.run_check_url}",
|
||||
self.record_url: f"{login_redirect_base}{self.record_url}",
|
||||
self.deduction_new_url: f"{login_redirect_base}{self.deduction_new_url}",
|
||||
self.deduction_remove_url: f"{login_redirect_base}{self.deduction_remove_url}",
|
||||
self.revocation_new_url: f"{login_redirect_base}{self.revocation_new_url}",
|
||||
self.revocation_remove_url: f"{login_redirect_base}{self.revocation_remove_url}",
|
||||
}
|
||||
|
||||
self.assert_url_success(client, success_urls)
|
||||
@ -96,6 +112,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.share_create_url,
|
||||
self.run_check_url,
|
||||
self.record_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
|
||||
self.assert_url_success(client, success_urls)
|
||||
@ -128,6 +148,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.edit_url,
|
||||
self.remove_url,
|
||||
self.share_create_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
fail_urls = [
|
||||
self.run_check_url,
|
||||
@ -172,6 +196,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.remove_url,
|
||||
self.share_create_url,
|
||||
self.log_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
success_urls_redirect = {
|
||||
self.share_url: self.detail_url
|
||||
@ -212,6 +240,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.remove_url,
|
||||
self.share_create_url,
|
||||
self.record_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
success_urls_redirect = {
|
||||
self.share_url: self.detail_url
|
||||
@ -252,6 +284,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.share_create_url,
|
||||
self.record_url,
|
||||
self.run_check_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
success_urls_redirect = {
|
||||
self.share_url: self.detail_url
|
||||
@ -292,6 +328,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.remove_url,
|
||||
self.share_create_url,
|
||||
self.run_check_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
success_urls_redirect = {
|
||||
self.share_url: self.detail_url
|
||||
@ -332,6 +372,10 @@ class InterventionViewTestCase(BaseViewTestCase):
|
||||
self.remove_url,
|
||||
self.share_create_url,
|
||||
self.run_check_url,
|
||||
self.revocation_new_url,
|
||||
self.revocation_remove_url,
|
||||
self.deduction_new_url,
|
||||
self.deduction_remove_url,
|
||||
]
|
||||
# Define urls where a redirect to a specific location is the proper response
|
||||
success_urls_redirect = {
|
||||
|
@ -341,6 +341,7 @@ def remove_view(request: HttpRequest, id: str):
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(Intervention, "id")
|
||||
def remove_revocation_view(request: HttpRequest, id: str, revocation_id: str):
|
||||
""" Renders a remove view for a revocation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user