Commit 502b906b authored by Sigmund Augdal's avatar Sigmund Augdal

Added test for any source with protocol ip

parent 0c81aa5b
......@@ -88,6 +88,27 @@ class TestProcessSecurityGroup(object):
self.generator.add_ipset_member_family.assert_any_call(iptables_configurator.RULES_FROM_ANY,
'00:11:22:33:44:55', 'inet', ',tcp:22', None, self.generator.addresses_v4)
@mock.patch('nova_router.security_groups.get_group_members')
@mock.patch('nova_router.security_groups.get_group_mode')
@mock.patch('nova_router.security_groups.get_group_rules')
def test_ip_protocol_from_any(self, get_group_rules, get_group_mode, get_group_members):
get_group_members.return_value = ['00:11:22:33:44:55', ['00:11:22:33:44:55']]
get_group_mode.return_value = "closed"
get_group_rules.return_value = [
{
'id': 1,
'protocol': 'ip',
'source_type': 'any',
},
]
self.generator.process_security_group("a", "b")
self.generator.add_ipset_member.assert_called_with(iptables_configurator.RULES_FROM_ANY,
'00:11:22:33:44:55', 'ip', None)
self.generator.add_ipset_member_family.assert_any_call(iptables_configurator.RULES_FROM_ANY_TO_IP,
'00:11:22:33:44:55', 'inet6', '', None, self.generator.addresses_v6)
self.generator.add_ipset_member_family.assert_any_call(iptables_configurator.RULES_FROM_ANY_TO_IP,
'00:11:22:33:44:55', 'inet', '', None, self.generator.addresses_v4)
@mock.patch('nova_router.security_groups.get_group_members')
@mock.patch('nova_router.security_groups.get_group_mode')
@mock.patch('nova_router.security_groups.get_group_rules')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment