From cb0a40c0a38e2f373bb1cc554a7699de2b73674b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn=20K=C3=BCnsem=C3=B6ller?=
 <jkuensem@physik.uni-bielefeld.de>
Date: Wed, 14 Jul 2021 09:42:42 +0200
Subject: [PATCH] TMSS-535: missing assertion in test

---
 ...egies_specification_and_scheduling_test.py | 41 ++++++-------------
 1 file changed, 12 insertions(+), 29 deletions(-)

diff --git a/SAS/TMSS/backend/test/t_observation_strategies_specification_and_scheduling_test.py b/SAS/TMSS/backend/test/t_observation_strategies_specification_and_scheduling_test.py
index 0951b07cb81..eb7f215048e 100755
--- a/SAS/TMSS/backend/test/t_observation_strategies_specification_and_scheduling_test.py
+++ b/SAS/TMSS/backend/test/t_observation_strategies_specification_and_scheduling_test.py
@@ -494,35 +494,18 @@ class TestObservationStrategiesSpecificationAndScheduling(unittest.TestCase):
         # "mimic" that the cal_obs_subtask finished (including qa subtasks)
         for subtask in cal_obs_task['subtasks']:
             set_subtask_state_following_allowed_transitions(subtask['id'], 'finished')
-        #self.check_statuses(cal_obs_subtask['id'], "finished", "finished", "observed")
-        # todo: check_statuses does not allow for different statuses of multiple related tasks
-        #  Either fix that, or fix the inconsistent statuses for target and calibrator tasks here.
-        # 99: ======================================================================
-        # 99: FAIL: test_lba_survey (__main__.TestObservationStrategiesSpecificationAndScheduling)
-        # 99: ----------------------------------------------------------------------
-        # 99: Traceback (most recent call last):
-        # 99:   File "t_observation_strategies_specification_and_scheduling_test.py", line 493, in test_lba_survey
-        # 99:     self.check_statuses(cal_obs_subtask['id'], "finished", "finished", "observed")   # todo: verify
-        # 99:   File "t_observation_strategies_specification_and_scheduling_test.py", line 77, in check_statuses
-        # 99:     self.assertEqual(expected_task_status, task['status'])
-        # 99: AssertionError: 'finished' != 'observed'
-        # 99: - finished
-        # 99: + observed
-        # 99:
-        #
-        #
-        # 99: ======================================================================
-        # 99: FAIL: test_lba_survey (__main__.TestObservationStrategiesSpecificationAndScheduling)
-        # 99: ----------------------------------------------------------------------
-        # 99: Traceback (most recent call last):
-        # 99:   File "t_observation_strategies_specification_and_scheduling_test.py", line 493, in test_lba_survey
-        # 99:     self.check_statuses(cal_obs_subtask['id'], "finished", "observed", "observed")   # todo: verify
-        # 99:   File "t_observation_strategies_specification_and_scheduling_test.py", line 77, in check_statuses
-        # 99:     self.assertEqual(expected_task_status, task['status'])
-        # 99: AssertionError: 'observed' != 'finished'
-        # 99: - observed
-        # 99: + finished
-        # 99:
+
+        # todo: check_statuses does not allow for different statuses of multiple related tasks, so we cannot do
+        #  self.check_statuses(cal_obs_subtask['id'], "finished", "finished", "observed")
+        #  but have to assert here directly. (Why are the statuses for target and calibrator tasks inconsistent here?)
+        cal_obs_subtask = self.tmss_client.get_subtask(cal_obs_subtask['id'])
+        self.assertEqual("finished", cal_obs_subtask['state_value'])
+        cal_obs_task = self.tmss_client.get_url_as_json_object(cal_obs_task['url'])
+        self.assertEqual("finished", cal_obs_task['status'])
+        target_obs_task = self.tmss_client.get_url_as_json_object(target_obs_task['url'])
+        self.assertEqual("observed", target_obs_task['status'])
+        schedunit = self.tmss_client.get_url_as_json_object(scheduling_unit_blueprint['url'])
+        self.assertEqual("observed", schedunit['status'])
 
         # -------------------
         # check pipelines
-- 
GitLab