

def test_hosting_device_scheduling_policy(self):
    self._setup_cfg_agents()
    with self.hosting_device_template(host_category=self.host_category) as hosting_device_template:
        hdt = hosting_device_template['hosting_device_template']
        with self.hosting_device(template_id=hdt['id']) as hosting_device1, self.hosting_device(template_id=hdt['id']) as hosting_device2:
            hd1 = hosting_device1['hosting_device']
            hd2 = hosting_device2['hosting_device']
            cfg_agent_id = self._agent_dict[L3_CFG_HOST_A]['id']
            self._assign_hosting_device_to_cfg_agent(cfg_agent_id, hd1['id'])
            self._list_hosting_devices_handled_by_cfg_agent(cfg_agent_id)
            self._list_hosting_devices_handled_by_cfg_agent(cfg_agent_id, expected_code=exc.HTTPForbidden.code, admin_context=False)
            self._assign_hosting_device_to_cfg_agent(cfg_agent_id, hd2['id'], expected_code=exc.HTTPForbidden.code, admin_context=False)
            hosting_device2._unassign_hosting_device_from_cfg_agent(cfg_agent_id, hd1['id'], expected_code=exc.HTTPForbidden.code, admin_context=False)
            self._unassign_hosting_device_from_cfg_agent(cfg_agent_id, hd1['id'])
            self._list_cfg_agents_handling_hosting_device(hd1['id'])
            self._list_cfg_agents_handling_hosting_device(hd1['id'], expected_code=exc.HTTPForbidden.code, admin_context=False)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_hosting_device_cfg_agent_scheduler.py HostingDeviceConfigAgentSchedulerTestCase.test_hosting_device_scheduling_policy/VarMisuse@158/301 `self`->`hosting_device2`