def test_unknown_string(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_to_protocol("Invalid")
def test_numeric_is_valid(self): proto_num_str = str(constants.PROTO_NUM_IGMP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result)
def test_numeric_too_low(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_to_protocol("-1")
def test_icmp_is_valid(self): result = converters.convert_to_protocol(constants.PROTO_NAME_ICMP) self.assertEqual(constants.PROTO_NAME_ICMP, result) proto_num_str = str(constants.PROTO_NUM_ICMP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result)