

def test_get_hosting_device_configuration_no_agent_found(self):
    ctx = n_context.Context(user_id=None, tenant_id=None, is_admin=False, overwrite=False)
    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) as hd:
                hd_id = hd['hosting_device']['id']
                rpc = devmgr_rpc_cfgagent_api.DeviceMgrCfgAgentNotifyAPI(self._devmgr)
                self._devmgr.agent_notifiers = {
                    c_constants.AGENT_TYPE_CFG: rpc,
                }
                self._devmgr.get_cfg_agents_for_hosting_devices = None
                with mock.patch.object(rpc.client, 'prepare', return_value=rpc.client) as mock_prepare, mock.patch.object(rpc.client, 'call') as mock_call, mock.patch.object(self._devmgr, 'get_cfg_agents_for_hosting_devices') as agt_mock:
                    agt_mock.return_value = []
                    res = self._devmgr.get_hosting_device_config(ctx, hd_id)
                    self.assertIsNone(res)
                    agt_mock.assert_called_once_with(mock.ANY, [hd_id], admin_state_up=True, schedule=True)
                    self.assertEqual(0, mock_prepare.call_count)
                    self.assertEqual(0, mock_call.call_count)

dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/cisco/device_manager/test_db_device_manager.py TestDeviceManagerDBPlugin.test_get_hosting_device_configuration_no_agent_found/original