

def test_delete_hosting_device_template_in_use_fails(self):
    ctx = n_context.get_admin_context()
    with self.hosting_device_template() 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):
                mgmt_port_id.assertRaises(ciscohostingdevicemanager.HostingDeviceTemplateInUse, self._devmgr.delete_hosting_device_template, ctx, hdt_id)
                req = self.new_show_request('hosting_device_templates', hdt_id, fmt=self.fmt)
                res = req.get_response(self.ext_api)
                self.assertEqual(200, res.status_int)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py TestDeviceManagerDBPlugin.test_delete_hosting_device_template_in_use_fails/VarMisuse@81/143 `self`->`mgmt_port_id`