Commit abe505bf authored by Sigmund Augdal's avatar Sigmund Augdal

Move wrapping Generator methods to the setup method since many need these

parent 8e089dbf
......@@ -15,6 +15,9 @@ class TestProcessSecurityGroup(object):
self.generator.prepare()
self.generator.addresses_v4 = {'00:11:22:33:44:55': '127.0.0.1'}
self.generator.addresses_v6 = {'00:11:22:33:44:55': 'fe00::1'}
self.generator.create_ipset = mock.MagicMock(wraps=self.generator.create_ipset)
self.generator.add_ipset_net = mock.MagicMock(wraps=self.generator.add_ipset_net)
self.generator.add_ipset_member = mock.MagicMock(wraps=self.generator.add_ipset_member)
@mock.patch('nova_router.security_groups.get_group_members')
@mock.patch('nova_router.security_groups.get_group_mode')
......@@ -36,8 +39,6 @@ class TestProcessSecurityGroup(object):
'source_cidr': '10.0.0.2/32',
},
]
self.generator.create_ipset = mock.MagicMock(wraps=self.generator.create_ipset)
self.generator.add_ipset_net = mock.MagicMock(wraps=self.generator.add_ipset_net)
self.generator.process_security_group("a", "b")
self.generator.create_ipset.assert_called_with(iptables_configurator.RULES_FROM_CIDR_TO_IP, "hash:net", True)
assert self.generator.add_ipset_net.call_count == 2
......@@ -59,7 +60,6 @@ class TestProcessSecurityGroup(object):
'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_CIDR,
"00:11:22:33:44:55", "tcp", 22,
......@@ -79,7 +79,6 @@ class TestProcessSecurityGroup(object):
'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)
......@@ -99,7 +98,6 @@ class TestProcessSecurityGroup(object):
'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('rls_by_src1', '00:11:22:33:44:55', 'tcp', 22)
......
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