def test_prepare_port_filter_initialized_port(self):
    port_dict = {'device': 'port-id', 'security_groups': [1]}
    self._prepare_security_group()
    self.firewall.prepare_port_filter(port_dict)
    self.assertFalse(self.mock_bridge.br.delete_flows.called)
    self.firewall.prepare_port_filter(port_dict)
    self.assertTrue(self.mock_bridge.br.delete_flows.called)
def test_prepare_port_filter_initialized_port(self):
    port_dict = {'device': 'port-id', 'security_groups': [1]}
    self._prepare_security_group()
    self.firewall.prepare_port_filter(port_dict)
    self.assertFalse(self.mock_bridge.br.delete_flows.called)
    self.firewall.prepare_port_filter(port_dict)
    self.assertTrue(self.mock_bridge.br.delete_flows.called)