Ejemplo n.º 1
0
 def test_validate_address_not_string(self):
     """ Assumptions:
             - given address is not a string
     """
     address = 1111
     with self.assertRaisesRegex(IpAddressNotValidError, "must be String"):
         IpOp.validate_address(address)
Ejemplo n.º 2
0
 def test_validate_address_regex_match(self):
     """ Assumptions:
             - given correct IP address match regex.
     """
     good_addresses = ["1.1.1.1", "11.11.11.11", "111.111.111.111"]
     for good_address in good_addresses:
         try:
             IpOp.validate_address(good_address)
         except IpAddressNotValidError:
             self.fail("IpAddressNotValidError raised.")
Ejemplo n.º 3
0
 def test_validate_address_regex_not_match(self):
     """ Assumptions:
             - given address does not match respective regex for ip
     """
     wrong_addresses = [
         "0000.0.0.0",
         "0.0000.0.0",
         "0.0.0000.0",
         "0.0.0.0000",
         ".0.0.0",
         "0..0.0",
         "0.0..0",
         "0.0.0..",
     ]
     for wrong_address in wrong_addresses:
         with self.assertRaisesRegex(IpAddressNotValidError,
                                     "does not match regex"):
             IpOp.validate_address(wrong_address)