Commit 03e06cb7 authored by Sigmund Augdal's avatar Sigmund Augdal

Added unit test for tcp from any rule

parent 16b3b02a
......@@ -44,6 +44,24 @@ class TestProcessSecurityGroup(object):
self.generator.add_ipset_net.assert_has_calls([mock.call('rls_cidr_to_ip1', '10.0.0.1/32'),
mock.call('rls_cidr_to_ip1', '10.0.0.2/32')], True)
@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_tcp_any_protocol(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': 'tcp',
'source_type': 'any',
'destination_port': 22,
},
]
self.generator.add_ipset_member = mock.MagicMock(wraps=self.generator.add_ipset_member)
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', 'tcp', 22)
class TestNextGeneration(object):
def test_first_run(self):
......
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