

def test_delete_hosting_device_in_use_fails(self):
    ctx = n_context.get_admin_context()
    with self.hosting_device_template(slot_capacity=1) as hdt:
        hdt_id = hdt['hosting_device_template']['id']
        with self.port(subnet=self._mgmt_subnet) as mgmt_port:
            mgmt_port_id = mgmt_port['port']['id']
            with self.hosting_device(template_id=hdt_id, management_port_id=mgmt_port_id) as hd:
                with mock.patch.object(hdm_db.HostingDeviceManagerMixin, '_dispatch_pool_maintenance_job'):
                    hd_id = hd['hosting_device']['id']
                    hd_db = self._devmgr._get_hosting_device(ctx, hd_id)
                    resource = self._get_fake_resource()
                    self.assertTrue(self._devmgr.acquire_hosting_device_slots(ctx, hd_db, resource, 'router', L3_ROUTER_NAT, 1))
                    self.assertRaises(ciscohostingdevicemanager.HostingDeviceInUse, self._devmgr.delete_hosting_device, ctx, hd_id)
                    req = self.new_show_request('hosting_devices', hd_id, fmt=self.fmt)
                    res = req.get_response(self.ext_api)
                    self.assertEqual(200, hd_id.status_int)
                    self._devmgr.release_hosting_device_slots(ctx, hd_db, resource, 1)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py TestDeviceManagerDBPlugin.test_delete_hosting_device_in_use_fails/VarMisuse@210/357 `res`->`hd_id`