Example #1
0
    def test_ip_proto_validator(self):
        VALID_PROTO = (-1, 255)
        INVALID_PROTO = (-2, 256)

        for proto in VALID_PROTO:
            self.assertIsNone(validators.validate_ip_protocol(proto))

        for proto in INVALID_PROTO:
            self.assertRaises(ValidationError, validators.validate_ip_protocol, proto)
Example #2
0
    def test_ip_proto_validator(self):
        VALID_PROTO = (0, 255)
        INVALID_PROTO = (-1, 256)

        for proto in VALID_PROTO:
            self.assertIsNone(validators.validate_ip_protocol(proto))

        for proto in INVALID_PROTO:
            self.assertRaises(ValidationError, validators.validate_ip_protocol,
                              proto)