Skip to content
Snippets Groups Projects
Commit df8385ac authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-778: test that we can set the error reason once, and are not allowed to overwrite it

parent f987fc11
No related branches found
No related tags found
2 merge requests!634WIP: COBALT commissioning delta,!610Resolve TMSS-778
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment