Index: suite_leahi/tst_rinseback/test.py =================================================================== diff -u -r9ec08c6d0259a8309489ebf04e217d767b9d2ecd -rab8c9554486ad673aa83390f8ad877cc838f96b8 --- suite_leahi/tst_rinseback/test.py (.../test.py) (revision 9ec08c6d0259a8309489ebf04e217d767b9d2ecd) +++ suite_leahi/tst_rinseback/test.py (.../test.py) (revision ab8c9554486ad673aa83390f8ad877cc838f96b8) @@ -32,19 +32,25 @@ import can # plugin specific -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols import CAN -from leahi_dialin.ui import utils -from configuration import utility,config -from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.ui_defs import TXStates -from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates -from leahi_dialin.utils import conversions +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.ui import utils +from configuration import utility,config +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.ui_defs import TXStates +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from leahi_dialin.utils import conversions +from configuration.getrejectiontext import ScopedRejectionRepository +from pathlib import Path td = TD_Messaging() can_interface = td.can_interface rinsebackrequest = None + +conf_path = Path.home() / config.CONFIGURATIONS_PATH / "Alarms/Rejections.conf" +repo = ScopedRejectionRepository(path=conf_path) + def change_treatmentstates(state,substate): td.td_tx_state( state, 0 , @@ -109,8 +115,11 @@ test.verify(waitFor( lambda: rinsebackrequest == 0, 3000), "Testing FW received Start Blood Return Value") td.td_rinseback_cmd_response(vRejectionReason = 1) - rejectionReason = waitForObject(utility.setObjectText(text=config.REQUEST,obj =names.o_EndTreatmentRinsebackInit_NotificationBar_NotificationBarSmall)) - test.compare(rejectionReason.text,config.REQUEST, "Rejection Reason text should be :" + str(rejectionReason.text)) + + + REJECT_TEXT = repo.get("1", "Title") + rejectionReason = waitForObject(utility.setObjectText(text="[1] "+ REJECT_TEXT,obj =names.o_EndTreatmentRinsebackInit_NotificationBar_NotificationBarSmall)) + test.compare(rejectionReason.text,"[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text)) test.endSection() def verify_pressure_value(): @@ -189,8 +198,10 @@ mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect, 2000)) test.verify(waitFor( lambda: rinsebackrequest == 3, 3000), "Testing FW received Pause Rinseback request") td.td_rinseback_cmd_response(vRejectionReason = 1) - rejectionReason = waitForObject(utility.setObjectText(text=config.REQUEST,obj =names.o_EndTreatmentRinseback_NotificationBar_NotificationBarSmall)) - test.compare(rejectionReason.text,config.REQUEST, "Rejection Reason text should be :" + str(rejectionReason.text)) + + REJECT_TEXT = repo.get("1", "Title") + rejectionReason = waitForObject(utility.setObjectText(text="[1] "+ REJECT_TEXT,obj =names.o_EndTreatmentRinseback_NotificationBar_NotificationBarSmall)) + test.compare(rejectionReason.text,"[1] "+ REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text)) td.td_rinseback_cmd_response(vRejectionReason = 0) change_treatmentstates( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, TXStates.RINSEBACK_PAUSED_STATE) @@ -256,12 +267,16 @@ def main(): utils.tstStart(__file__) + startApplication(utility.aut('-q')) global rinsebackrequest - if can_interface is not None: - channel_id = CAN.CanChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, + if can_interface is None: + test.fail("CAN Interface is not available. Stopping tests.") + return + + channel_id = CAN.CanChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, message_id, handle_rinseback_request)