Esempio n. 1
0
 def test_zal_iter(self) -> None:
     whitelist = medmij.Whitelist(testdata.WHITELIST_EXAMPLE_XML)
     self.assertIsInstance(len(whitelist), int)
     self.assertGreaterEqual(len(whitelist), 1)
     whlst = list(whitelist)
     for e in whlst:
         self.assertIsInstance(e, str)
Esempio n. 2
0
 def test_whitelist_contains(self) -> None:
     whitelist = medmij.Whitelist(testdata.WHITELIST_EXAMPLE_XML)
     self.assertIn("rcf-rso.nl", whitelist)
     self.assertNotIn("rcf-rso.nl.", whitelist)
     self.assertNotIn("RFC-RSO.NL", whitelist)
     self.assertNotIn(None, whitelist)
Esempio n. 3
0
 def test_parse_xsd_fail(self) -> None:
     for xml in (testdata.WHITELIST_XSD_FAIL1,
                 testdata.WHITELIST_XSD_FAIL2):
         with self.assertRaises(lxml.etree.XMLSyntaxError):
             medmij.Whitelist(xml)
Esempio n. 4
0
 def test_parse_invalid_xml(self) -> None:
     with self.assertRaises(lxml.etree.XMLSyntaxError):
         medmij.Whitelist('<kapot')
Esempio n. 5
0
 def test_parse_ok(self) -> None:
     for xml in (testdata.WHITELIST_EXAMPLE_XML,
                 testdata.WHITELIST_EXAMPLE_SINGLE_XML):
         whitelist = medmij.Whitelist(xml)
         self.assertTrue(isinstance(whitelist, medmij.Whitelist))