diff --git a/atdb/taskdatabase/tests/test_models_joins.py b/atdb/taskdatabase/tests/test_models_joins.py index a540ab527d0d2107d481e3e13e71ba99e8d54c8f..de89551bb2728545889965b377eabcd3600de9e0 100644 --- a/atdb/taskdatabase/tests/test_models_joins.py +++ b/atdb/taskdatabase/tests/test_models_joins.py @@ -17,7 +17,7 @@ class TestJoinedTasks(TestCase): Task.objects.get_or_create(sas_id=1, status='stored') Task.objects.get_or_create(sas_id=2, status='stored') Task.objects.get_or_create(sas_id=3, status='defined') - + Task.objects.get_or_create(sas_id=4, status='defined') def test_add_input_tasks_to_task(self): output_task = Task.objects.get(sas_id=1) @@ -51,4 +51,21 @@ class TestJoinedTasks(TestCase): output_task.save() # two input tasks 'stored', should give: 'stored' - self.assertEqual(output_task.joined_status, "stored") \ No newline at end of file + self.assertEqual(output_task.joined_status, "stored") + + def test_is_task_type_join(self): + output_task = Task.objects.get(sas_id=3) + input_task_1 = Task.objects.get(sas_id=2) # stored + input_task_2 = Task.objects.get(sas_id=1) # stored + regular_task_3 = Task.objects.get(sas_id=4) + output_task.joined_input_tasks.set([input_task_1, input_task_2]) + output_task.save() + + # the input task should be of the type 'join' + self.assertEqual(input_task_1.task_type_join, "join") + + # the output task should be of the type 'joined' + self.assertEqual(output_task.task_type_join, "joined") + + # a task without input/output tasks should be 'regular' + self.assertEqual(regular_task_3.task_type_join, "regular") \ No newline at end of file