def expect_deny(self, badhostname, msg): denied = False try: xxx = HostStruct(badhostname) except PolicyError: denied = True self.assertTrue(denied, ("%s" % msg))
def check_hostaddr_match(self, tHostAddr, tString, expectOk=True): # check that the string is a match for the addr # check that the internal struct version matches, too ha = HostStruct(tString) if expectOk: self.assertTrue(tHostAddr.match_str(tString)) self.assertTrue(tHostAddr.match_bin(ha)) else: self.assertFalse(tHostAddr.match_str(tString)) self.assertFalse(tHostAddr.match_bin(ha))