def test_sg_removed(self):
    with mock.patch.object(self.manager.conj_id_map, 'get_conj_id') as get_id_mock, mock.patch.object(self.manager.conj_id_map, 'delete_sg') as delete_sg_mock:
        get_id_mock.return_value = self.conj_id
        delete_sg_mock.return_value = [('remote_id', self.conj_id)]
        self.manager.add(self.vlan_tag, 'sg', 'remote_id', firewall.INGRESS_DIRECTION, constants.IPv4, 0)
        self.manager.flow_state[self.vlan_tag][(firewall.INGRESS_DIRECTION, constants.IPv4)] = {'10.22.3.4': [self.conj_id]}
        self.manager.sg_removed('sg')
    self.driver._add_flow.assert_not_called()
    self.driver.delete_flows_for_ip_addresses.assert_called_once_with({'10.22.3.4'}, firewall.INGRESS_DIRECTION, constants.IPv4, self.vlan_tag)
def test_sg_removed(self):
    with mock.patch.object(self.manager.conj_id_map, 'get_conj_id') as get_id_mock, mock.patch.object(self.manager.conj_id_map, 'delete_sg') as delete_sg_mock:
        get_id_mock.return_value = self.conj_id
        delete_sg_mock.return_value = [('remote_id', self.conj_id)]
        self.manager.add(self.vlan_tag, 'sg', 'remote_id', firewall.INGRESS_DIRECTION, constants.IPv4, 0)
        self.manager.flow_state[self.vlan_tag][(firewall.INGRESS_DIRECTION, constants.IPv4)] = {'10.22.3.4': [self.conj_id]}
        self.manager.sg_removed('sg')
    self.driver._add_flow.assert_not_called()
    self.driver.delete_flows_for_ip_addresses.assert_called_once_with({'10.22.3.4'}, firewall.INGRESS_DIRECTION, constants.IPv4, self.vlan_tag)