def test_it_condition_have_proto_protocol_and_port_port_for_cidr_ports_must_only_fail(self): step = MockedStep() condition = 'only' proto = 'not important' port = '1-2' cidr = 'not important' with self.assertRaises(Failure) as err: it_condition_have_proto_protocol_and_port_port_for_cidr(step, condition, proto, port, cidr) self.assertEqual(str(err.exception), '"must only" scenario cases must be used either with individual port ' 'or multiple ports separated with comma.')
def test_it_condition_have_proto_protocol_and_port_port_for_cidr_port_success(self): step = MockedStep() step.context.stash = [] condition = 'not important' proto = 'not important' port = '1' cidr = 'not important' self.assertTrue(it_condition_have_proto_protocol_and_port_port_for_cidr(step, condition, proto, port, cidr))