#86 Edit deductions
* adds support for editing deductions * adds tests * improves major base test logic
This commit is contained in:
@@ -21,29 +21,32 @@ class CompensationViewTestCase(BaseViewTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls) -> None:
|
||||
super().setUpTestData()
|
||||
state = cls.create_dummy_states()
|
||||
cls.compensation.before_states.set([state])
|
||||
cls.compensation.after_states.set([state])
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
state = self.create_dummy_states()
|
||||
self.compensation.before_states.set([state])
|
||||
self.compensation.after_states.set([state])
|
||||
|
||||
action = cls.create_dummy_action()
|
||||
cls.compensation.actions.set([action])
|
||||
action = self.create_dummy_action()
|
||||
self.compensation.actions.set([action])
|
||||
|
||||
# Prepare urls
|
||||
cls.index_url = reverse("compensation:index", args=())
|
||||
cls.new_url = reverse("compensation:new", args=(cls.intervention.id,))
|
||||
cls.new_id_url = reverse("compensation:new-id", args=())
|
||||
cls.detail_url = reverse("compensation:detail", args=(cls.compensation.id,))
|
||||
cls.log_url = reverse("compensation:log", args=(cls.compensation.id,))
|
||||
cls.edit_url = reverse("compensation:edit", args=(cls.compensation.id,))
|
||||
cls.remove_url = reverse("compensation:remove", args=(cls.compensation.id,))
|
||||
cls.report_url = reverse("compensation:report", args=(cls.compensation.id,))
|
||||
cls.state_new_url = reverse("compensation:new-state", args=(cls.compensation.id,))
|
||||
cls.action_new_url = reverse("compensation:new-action", args=(cls.compensation.id,))
|
||||
cls.deadline_new_url = reverse("compensation:new-deadline", args=(cls.compensation.id,))
|
||||
cls.new_doc_url = reverse("compensation:new-doc", args=(cls.compensation.id,))
|
||||
self.index_url = reverse("compensation:index", args=())
|
||||
self.new_url = reverse("compensation:new", args=(self.intervention.id,))
|
||||
self.new_id_url = reverse("compensation:new-id", args=())
|
||||
self.detail_url = reverse("compensation:detail", args=(self.compensation.id,))
|
||||
self.log_url = reverse("compensation:log", args=(self.compensation.id,))
|
||||
self.edit_url = reverse("compensation:edit", args=(self.compensation.id,))
|
||||
self.remove_url = reverse("compensation:remove", args=(self.compensation.id,))
|
||||
self.report_url = reverse("compensation:report", args=(self.compensation.id,))
|
||||
self.state_new_url = reverse("compensation:new-state", args=(self.compensation.id,))
|
||||
self.action_new_url = reverse("compensation:new-action", args=(self.compensation.id,))
|
||||
self.deadline_new_url = reverse("compensation:new-deadline", args=(self.compensation.id,))
|
||||
self.new_doc_url = reverse("compensation:new-doc", args=(self.compensation.id,))
|
||||
|
||||
cls.state_remove_url = reverse("compensation:state-remove", args=(cls.compensation.id, cls.comp_state.id,))
|
||||
cls.action_remove_url = reverse("compensation:action-remove", args=(cls.compensation.id, cls.comp_action.id,))
|
||||
self.state_remove_url = reverse("compensation:state-remove", args=(self.compensation.id, self.comp_state.id,))
|
||||
self.action_remove_url = reverse("compensation:action-remove", args=(self.compensation.id, self.comp_action.id,))
|
||||
|
||||
def test_anonymous_user(self):
|
||||
""" Check correct status code for all requests
|
||||
|
||||
@@ -21,17 +21,18 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
||||
def setUpTestData(cls):
|
||||
super().setUpTestData()
|
||||
|
||||
# Give the user shared access to the dummy intervention -> inherits the access to the compensation
|
||||
cls.intervention.share_with(cls.superuser)
|
||||
|
||||
# Make sure the intervention itself would be fine with valid data
|
||||
cls.intervention = cls.fill_out_intervention(cls.intervention)
|
||||
|
||||
# Make sure the compensation is linked to the intervention
|
||||
cls.intervention.compensations.set([cls.compensation])
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
|
||||
# Give the user shared access to the dummy intervention -> inherits the access to the compensation
|
||||
self.intervention.share_with(self.superuser)
|
||||
|
||||
# Make sure the intervention itself would be fine with valid data
|
||||
self.intervention = self.fill_out_intervention(self.intervention)
|
||||
|
||||
# Make sure the compensation is linked to the intervention
|
||||
self.intervention.compensations.set([self.compensation])
|
||||
|
||||
# Delete all existing compensations, which might be created by tests
|
||||
Compensation.objects.all().delete()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user