Commit dea55825 authored by Sigmund Augdal's avatar Sigmund Augdal

Added unit test for rules with source security group and protocol == ip

parent 502b906b
......@@ -127,6 +127,23 @@ class TestProcessSecurityGroup(object):
self.generator.process_security_group("a", "b")
self.generator.add_ipset_member.assert_called_with('rls_by_src1', '00:11:22:33:44:55', 'tcp', 22)
@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_sg(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': 'security_group',
'source_security_group': '1',
},
]
self.generator.process_security_group("a", "b")
self.generator.add_ipset_member.assert_called_with('rls_by_src_to_ip2', '00:11:22:33:44:55', 'ip')
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