def test_wrong_group(self): """ Tests that if there is an unexpected segment the message in not validated The message used has an unexpected OML_O33_PATIENT """ msg = self._create_message(self.adt_a01) oml_o33_patient = Group('OML_O33_PATIENT') segments = parse_segments('PID|||1010110909194822^^^GATEWAY_IL&1.3.6.1.4.1.21367.2011.2.5.17&ISO^PK||PIPPO^PLUTO^^^^^L||19790515|M|||VIA DI TOPOLINO^CAGLIARI^CAGLIARI^^09100^100^H^^092009~^^^^^^L|||||||PPPPPP79E15B354I^^^CF|||||CAGLIARI|||100\rPV1||O|||||||||||||||||1107080001^^^LIS') oml_o33_patient.children = segments msg.add(oml_o33_patient) self.assertFalse(msg.validate())
def test_having_more_groups(self): """ Tests that when a group occurs more than the allowed times the message is not validated The message used has 2 occurrence of oml_o33_group """ msg = self._create_message(self.oml_o33) oml_o33_patient = Group('OML_O33_PATIENT') segments = parse_segments('PID|||1010110909194822^^^GATEWAY_IL&1.3.6.1.4.1.21367.2011.2.5.17&ISO^PK||PIPPO^PLUTO^^^^^L||19790515|M|||VIA DI TOPOLINO^CAGLIARI^CAGLIARI^^09100^100^H^^092009~^^^^^^L|||||||PPPPPP79E15B354I^^^CF|||||CAGLIARI|||100\rPV1||O|||||||||||||||||1107080001^^^LIS') oml_o33_patient.children = segments msg.add(oml_o33_patient) self.assertFalse(msg.validate())
def test_wrong_group(self): """ Tests that if there is an unexpected segment the message in not validated The message used has an unexpected OML_O33_PATIENT """ msg = self._create_message(self.rsp_k21) oml_o33_patient = Group('OML_O33_PATIENT') segments = parse_segments('PID|||1010110909194822^^^GATEWAY_IL&1.3.6.1.4.1.21367.2011.2.5.17&ISO^PK||PIPPO^PLUTO^^^^^L||19790515|M|||VIA DI TOPOLINO^CAGLIARI^CAGLIARI^^09100^100^H^^092009~^^^^^^L|||||||PPPPPP79E15B354I^^^CF|||||CAGLIARI|||100\rPV1||O|||||||||||||||||1107080001^^^LIS') oml_o33_patient.children = segments msg.add(oml_o33_patient) self.assertRaises(ValidationError, msg.validate, report_file=self.report_file) self._test_report_file('ERROR')
def test_having_more_groups(self): """ Tests that when a group occurs more than the allowed times the message is not validated The message used has 2 occurrence of oml_o33_group """ msg = self._create_message(self.oml_o33) oml_o33_patient = Group('OML_O33_PATIENT') segments = parse_segments('PID|||1010110909194822^^^GATEWAY_IL&1.3.6.1.4.1.21367.2011.2.5.17&ISO^PK||PIPPO^PLUTO^^^^^L||19790515|M|||VIA DI TOPOLINO^CAGLIARI^CAGLIARI^^09100^100^H^^092009~^^^^^^L|||||||PPPPPP79E15B354I^^^CF|||||CAGLIARI|||100\rPV1||O|||||||||||||||||1107080001^^^LIS') oml_o33_patient.children = segments msg.add(oml_o33_patient) self.assertRaises(ValidationError, msg.validate, report_file=self.report_file) self._test_report_file('ERROR')