def test_in_network(): """Helpers - In Network""" cidrs = {'10.0.16.0/24', '10.0.17.0/24'} ip_in_cidr = '10.0.16.24' assert_equal(base.in_network(ip_in_cidr, cidrs), True) ip_not_in_cidr = '10.0.15.24' assert_equal(base.in_network(ip_not_in_cidr, cidrs), False)
def test_in_network_invalid_cidr(): """Helpers - In Network - Invalid CIDR""" assert_false(base.in_network('127.0.0.1', {'not a cidr'}))
def test_in_network_invalid_ip(): """Helpers - In Network - Invalid IP""" assert_false( base.in_network('a string that is not an ip', {'10.0.100.0/24'}))