Beispiel #1
0
 def test_devices_details_list_unsupported(self):
     agent = rpc.PluginApi('fake_topic')
     ctxt = context.RequestContext('fake_user', 'fake_project')
     expect_val_get_device_details = 'foo'
     expect_val = [expect_val_get_device_details]
     with mock.patch('neutron.common.rpc.RpcProxy.call') as rpc_call:
         rpc_call.side_effect = [messaging.UnsupportedVersion('1.2'),
                                 expect_val_get_device_details]
         func_obj = getattr(agent, 'get_devices_details_list')
         actual_val = func_obj(ctxt, ['fake_device'], 'fake_agent_id')
     self.assertEqual(actual_val, expect_val)
 def test_devices_details_list_unsupported(self):
     agent = rpc.PluginApi('fake_topic')
     ctxt = oslo_context.RequestContext('fake_user', 'fake_project')
     expect_val_get_device_details = 'foo'
     expect_val = [expect_val_get_device_details]
     with contextlib.nested(
             mock.patch.object(agent.client, 'call'),
             mock.patch.object(agent.client, 'prepare'),
     ) as (mock_call, mock_prepare):
         mock_prepare.return_value = agent.client
         mock_call.side_effect = [
             messaging.UnsupportedVersion('1.2'),
             expect_val_get_device_details
         ]
         func_obj = getattr(agent, 'get_devices_details_list')
         actual_val = func_obj(ctxt, ['fake_device'], 'fake_agent_id')
     self.assertEqual(actual_val, expect_val)