

def _test_failed_hosting_device(self, host_category=VM_CATEGORY, expected_num_remaining=0, auto_delete=True, no_delete=True):
    with self.hosting_device_template(host_category=host_category) as hdt:
        hdt_id = hdt['hosting_device_template']['id']
        with self.port(subnet=self._mgmt_subnet, no_delete=no_delete) as mgmt_port:
            with self.hosting_device(template_id=hdt_id, management_port_id=mgmt_port['port']['id'], auto_delete=auto_delete, no_delete=no_delete) as hd:
                with mock.patch('neutron.manager.NeutronManager.get_service_plugins'):
                    hd_id = hd['hosting_device']['id']
                    m2 = mock.MagicMock()
                    self._devmgr.agent_notifiers = {
                        c_constants.AGENT_TYPE_CFG: m2,
                    }
                    context = self._get_test_context()
                    self._devmgr.handle_non_responding_hosting_devices(context, None, [hd_id])
                    result_hds = self._list('hosting_devices')['hosting_devices']
                    self.assertEqual(expected_num_remaining, len(result_hds))
                    l3mock = NeutronManager.get_service_plugins().get().handle_non_responding_hosting_devices
                    l3mock.assert_called_once_with(mock.ANY, mock.ANY, {
                        hd_id: {
                            
                        },
                    })
                    if (expected_num_remaining == 0):
                        auto_delete.hosting_devices_removed.assert_called_once_with(mock.ANY, {
                            hd_id: {
                                
                            },
                        }, False, None)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py TestDeviceManagerDBPlugin._test_failed_hosting_device/VarMisuse@242/406 `m2`->`auto_delete`