mercredi 22 avril 2015

Should test cases be written for methods that wrap third party code?

In my application I have method that validates a CIDR address. All it does is wraps around the ipv4 validate_cidr method:

def isValidCIDR(cidr):
    return iptools.ipv4.validate_cidr(cidr)

I don't like it personally. I'd rather just place the validation check in main().

The only reason I've done it this way is because I write the test to validate a CIDR address:

def test_input_for_valid_cidr_format(self):
    cidr = '192.168.2.4/24'
    self.assertTrue(self.scanner.isValidCIDR(cidr))

Is there any need to write such a test?

Aucun commentaire:

Enregistrer un commentaire