def test_contains_ip_permissions_true_case_4(self): ip_permissions = [ dict( in_out = 'OUT', ip_protocol = 'ANY', cidr_ip = '0.0.0.0/0', description = 'all outgoing protocols are allow', ), dict( in_out = 'IN', ip_protocol = 'UDP', from_port = 20000, group_name = 'admin', ), ] ip_permission = dict( in_out = 'IN', ip_protocol = 'UDP', from_port = 20000, to_port = 20000, group_name = 'admin', description = 'dummy', cidr_ip = None, ) self.assertTrue(niftycloud_fw.contains_ip_permissions(ip_permissions, ip_permission))
def test_contains_ip_permissions_false_case_3(self): ip_permissions = [ dict( in_out = 'OUT', ip_protocol = 'ANY', cidr_ip = '0.0.0.0/0', description = 'all outgoing protocols are allow', ), dict( in_out = 'IN', ip_protocol = 'TCP', from_port = 20000, to_port = 29999, group_name = 'admin', ), ] ip_permission = dict( in_out = 'OUT', ip_protocol = 'ALL', cidr_ip = '10.0.0.0/16', description = 'all outgoing protocols are allow', ) self.assertFalse(niftycloud_fw.contains_ip_permissions(ip_permissions, ip_permission))