diff --git a/SAS/TMSS/backend/test/t_subtasks.py b/SAS/TMSS/backend/test/t_subtasks.py index f4640eb670540b53cf24f2bfc967c22f53b30e1b..13d48f91803829d0950ba0c148be33b572ac72f3 100755 --- a/SAS/TMSS/backend/test/t_subtasks.py +++ b/SAS/TMSS/backend/test/t_subtasks.py @@ -754,9 +754,17 @@ class SubtaskAllowedStateTransitionsTest(unittest.TestCase): # then go to the error state (should be allowed from any of these intermediate states) subtask.state = SubtaskState.objects.get(value=SubtaskState.Choices.ERROR.value) - subtask.error_reason = 'test_helper_method_set_subtask_state_following_allowed_transitions_error_path' + ERROR_MESSAGE = 'test_helper_method_set_subtask_state_following_allowed_transitions_error_path' + subtask.error_reason = ERROR_MESSAGE subtask.save() self.assertEqual(SubtaskState.Choices.ERROR.value, subtask.state.value) + self.assertEqual(ERROR_MESSAGE, subtask.error_reason) + + # overwriting error reason should not be allowed + from django.db.utils import InternalError + with self.assertRaises(InternalError) as context: + subtask.error_reason = "overwriting error reason" + subtask.save() def test_helper_method_set_subtask_state_following_allowed_transitions_cancel_path(self): for desired_end_state_value in (SubtaskState.Choices.CANCELLING.value,SubtaskState.Choices.CANCELLED.value):