|
|
|
@ -60,8 +60,9 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|
|
|
|
|
|
|
|
|
# Preserve the current number of intervention's compensations
|
|
|
|
|
num_compensations = self.intervention.compensations.count()
|
|
|
|
|
self.client_user.post(new_url, post_data)
|
|
|
|
|
response = self.client_user.post(new_url, post_data)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(302, response.status_code)
|
|
|
|
|
self.intervention.refresh_from_db()
|
|
|
|
|
self.assertEqual(num_compensations + 1, self.intervention.compensations.count())
|
|
|
|
|
new_compensation = self.intervention.compensations.get(identifier=test_id)
|
|
|
|
@ -261,3 +262,26 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|
|
|
|
self.assertIn(recorded, self.compensation.log.all())
|
|
|
|
|
self.assertEqual(pre_record_log_count + 1, self.compensation.log.count())
|
|
|
|
|
|
|
|
|
|
def test_non_editable_after_recording(self):
|
|
|
|
|
""" Tests that the compensation can not be edited after being recorded
|
|
|
|
|
|
|
|
|
|
User must be redirected to another page
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
self.assertIsNotNone(self.compensation)
|
|
|
|
|
self.assertFalse(self.compensation.is_recorded)
|
|
|
|
|
edit_url = reverse("compensation:edit", args=(self.compensation.id,))
|
|
|
|
|
response = self.client_user.get(edit_url)
|
|
|
|
|
has_redirect = response.status_code == 302
|
|
|
|
|
self.assertFalse(has_redirect)
|
|
|
|
|
|
|
|
|
|
self.compensation.intervention.set_recorded(self.user)
|
|
|
|
|
self.assertTrue(self.compensation.is_recorded)
|
|
|
|
|
|
|
|
|
|
edit_url = reverse("compensation:edit", args=(self.compensation.id,))
|
|
|
|
|
response = self.client_user.get(edit_url)
|
|
|
|
|
has_redirect = response.status_code == 302
|
|
|
|
|
self.assertTrue(has_redirect)
|
|
|
|
|
self.compensation.intervention.set_unrecorded(self.user)
|
|
|
|
|