diff --git a/tests/test_cal_tools.py b/tests/test_cal_tools.py index 6bc8ae1cd2b8d9064001ea022081619b8ae01ef4..62567e43832923aa1d2b39b5491b56106f4c40ec 100644 --- a/tests/test_cal_tools.py +++ b/tests/test_cal_tools.py @@ -55,44 +55,45 @@ cal_db_interface = "tcp://max-exfl017:8020" def test_get_pdu_from_db(): + snapshot_at = "2021-05-06 00:20:10.00" + # A karabo_da str returns a list of one element. - pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CI-2", - karabo_da="TEST_DAQ_DA_01", + pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CAL_CI-1", + karabo_da="TEST_DET_CAL_DA0", constant=constant, condition=condition, cal_db_interface=cal_db_interface, - snapshot_at="2021-03-01 09:44:00+00:00", + snapshot_at=snapshot_at, timeout=30000) assert len(pdu_dict) == 1 - assert pdu_dict[0] == 'PHYSICAL_DETECTOR_UNIT-1_DO_NOT_DELETE' + assert pdu_dict[0] == "CAL_PHYSICAL_DETECTOR_UNIT-1_TEST" # A list of karabo_das to return thier PDUs, if available. - pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CI-2", - karabo_da=["TEST_DAQ_DA_01", "TEST_DAQ_DA_02", + pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CAL_CI-1", + karabo_da=["TEST_DET_CAL_DA0", "TEST_DET_CAL_DA1", "UNAVAILABLE_DA"], constant=constant, condition=condition, cal_db_interface=cal_db_interface, - snapshot_at="2021-03-01 09:44:00+00:00", + snapshot_at=snapshot_at, timeout=30000) - assert pdu_dict == ['PHYSICAL_DETECTOR_UNIT-1_DO_NOT_DELETE', - 'PHYSICAL_DETECTOR_UNIT-2_DO_NOT_DELETE', + assert pdu_dict == ["CAL_PHYSICAL_DETECTOR_UNIT-1_TEST", + "CAL_PHYSICAL_DETECTOR_UNIT-2_TEST", None] # "all" is used to return all corresponding units for a karabo_id. - pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CI-2", + pdu_dict = get_pdu_from_db(karabo_id="TEST_DET_CAL_CI-1", karabo_da="all", constant=constant, condition=condition, - cal_db_interface="tcp://max-exfl017:8020", - snapshot_at="2021-03-01 09:44:00+00:00", + cal_db_interface=cal_db_interface, + snapshot_at=snapshot_at, timeout=30000) - assert len(pdu_dict) == 3 - assert pdu_dict == ['PHYSICAL_DETECTOR_UNIT-1_DO_NOT_DELETE', - 'PHYSICAL_DETECTOR_UNIT-2_DO_NOT_DELETE', - 'PHYSICAL_DETECTOR_UNIT-3_DO_NOT_DELETE'] + assert len(pdu_dict) == 2 + assert pdu_dict == ["CAL_PHYSICAL_DETECTOR_UNIT-1_TEST", + "CAL_PHYSICAL_DETECTOR_UNIT-2_TEST"] @pytest.mark.requires_gpfs