diff --git a/SAS/TMSS/test/t_specify_observation.py b/SAS/TMSS/test/t_specify_observation.py index 60a43487c830692b57d80830bc7076ea94dc435a..f80b138af737d0b6d9ef852e24c4342470aeeaa1 100755 --- a/SAS/TMSS/test/t_specify_observation.py +++ b/SAS/TMSS/test/t_specify_observation.py @@ -39,17 +39,27 @@ from lofar.sas.tmss.test.tmss_test_data_rest import TMSSRESTTestDataCreator rest_data_creator = TMSSRESTTestDataCreator(BASE_URL, AUTH) from lofar.sas.tmss.tmss.tmssapp import models -from lofar.sas.tmss.tmss.tmssapp.tasks import run_specify_observation +from lofar.sas.tmss.tmss.tmssapp.tasks import create_task_blueprint_from_task_draft_and_instantiate_subtasks_from_template class SpecifyObservationFromTaskDraftTest(unittest.TestCase): - def test_01(self): + def test_create_task_blueprint(self): """ - Use the 'default' task draft (ID=1) to specify observation and check if all subtasks are created + Use the 'default' task draft (ID=1) to specify observation + Check if the task draft name is equal to the task draft name specified in the created task blueprint + Check with REST-call if 4 subtasks are created and if these subtaskshave state value 'defined' """ task_draft = models.TaskDraft.objects.get(id=1) - run_specify_observation(task_draft) - # TODO check the objects created + res_task_draft = GET_and_assert_equal_expected_code(self, BASE_URL + '/task_draft/1/', 200) + task_blueprint = create_task_blueprint_from_task_draft_and_instantiate_subtasks_from_template(task_draft) + self.assertEqual(task_draft.name, task_blueprint.draft.name) + res_task_blueprint = GET_and_assert_equal_expected_code(self, BASE_URL + '/task_blueprint/1/', 200) + self.assertEqual(len(res_task_blueprint['subtasks']), 4) + self.assertEqual(res_task_blueprint['specifications_template'], res_task_draft['specifications_template']) + for subtask_url in res_task_blueprint['subtasks']: + res_subtask = GET_and_assert_equal_expected_code(self, subtask_url, 200) + state_value = GET_and_assert_equal_expected_code(self, res_subtask['state'], 200)['value'] + self.assertEqual(state_value, "defined") if __name__ == "__main__":