本文整理匯總了Python中ion.agents.data.handlers.base_data_handler.BaseDataHandler.cmd_dvr方法的典型用法代碼示例。如果您正苦於以下問題:Python BaseDataHandler.cmd_dvr方法的具體用法?Python BaseDataHandler.cmd_dvr怎麽用?Python BaseDataHandler.cmd_dvr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ion.agents.data.handlers.base_data_handler.BaseDataHandler
的用法示例。
在下文中一共展示了BaseDataHandler.cmd_dvr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestBaseDataHandlerUnit
# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import cmd_dvr [as 別名]
#.........這裏部分代碼省略.........
config = {}
publisher = Mock()
unlock_new_data_callback = Mock()
update_new_data_check_attachment = Mock()
self.assertRaises(InstrumentParameterException, BaseDataHandler._acquire_sample, config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback, update_new_data_check_attachment=update_new_data_check_attachment)
@patch.object(BaseDataHandler, '_constraints_for_historical_request')
@patch('ion.agents.data.handlers.base_data_handler.EventPublisher')
@patch.object(BaseDataHandler, '_init_acquisition_cycle')
@patch.object(BaseDataHandler, '_get_data')
@patch.object(BaseDataHandler, '_publish_data')
def test__acquire_sample_with_constraints_testing_flag(self, _publish_data_mock, _get_data_mock, _init_acquisition_cycle_mock, EventPublisher_mock, _constraints_for_historical_request_mock):
granule1 = Mock(spec=Granule)
granule2 = Mock(spec=Granule)
granule3 = Mock(spec=Granule)
data_generator = [granule1, granule2, granule3]
_get_data_mock.return_value = data_generator
config = {'constraints': {'test_constraints': 'value'}, 'TESTING': True}
publisher = Mock()
unlock_new_data_callback = Mock()
update_new_data_check_attachment = Mock()
EventPublisher_mock.publish_event = Mock()
BaseDataHandler._acquire_sample(config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback, update_new_data_check_attachment=update_new_data_check_attachment)
_init_acquisition_cycle_mock.assert_called_once_with(config)
_get_data_mock.assert_called_once_with(config)
_publish_data_mock.assert_called_once_with(publisher, data_generator, config, update_new_data_check_attachment)
_constraints_for_historical_request_mock.assert_called_once_with(config)
EventPublisher_mock.publish_event.assert_called_once()
def test_cmd_dvr_initialize(self):
self._bdh.initialize = Mock()
self._bdh.initialize.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('initialize')
self._bdh.initialize.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource(self):
self._bdh.get = Mock()
self._bdh.get.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get_resource')
self._bdh.get.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_set(self):
self._bdh.set = Mock()
self._bdh.set.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('set_resource')
self._bdh.set.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_params(self):
self._bdh.get_resource_params = Mock()
self._bdh.get_resource_params.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get_resource_params')
self._bdh.get_resource_params.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_commands(self):
self._bdh.get_resource_commands = Mock()
self._bdh.get_resource_commands.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get_resource_commands')
self._bdh.get_resource_commands.assert_called_once()
示例2: TestBaseDataHandlerUnit
# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import cmd_dvr [as 別名]
#.........這裏部分代碼省略.........
def test__acquire_data_with_constraints_testing_flag(
self,
_publish_data_mock,
_get_data_mock,
_init_acquisition_cycle_mock,
EventPublisher_mock,
_constraints_for_historical_request_mock,
):
granule1 = Mock(spec=Granule)
granule2 = Mock(spec=Granule)
granule3 = Mock(spec=Granule)
data_generator = [granule1, granule2, granule3]
_get_data_mock.return_value = data_generator
config = {"constraints": {"test_constraints": "value"}, "TESTING": True}
publisher = Mock()
unlock_new_data_callback = Mock()
update_new_data_check_attachment = Mock()
EventPublisher_mock.publish_event = Mock()
BaseDataHandler._acquire_data(
config=config,
publisher=publisher,
unlock_new_data_callback=unlock_new_data_callback,
update_new_data_check_attachment=update_new_data_check_attachment,
)
_init_acquisition_cycle_mock.assert_called_once_with(config)
_get_data_mock.assert_called_once_with(config)
_publish_data_mock.assert_called_once_with(publisher, data_generator)
_constraints_for_historical_request_mock.assert_called_once_with(config)
EventPublisher_mock.publish_event.assert_called_once()
def test_cmd_dvr_initialize(self):
self._bdh.initialize = Mock()
self._bdh.initialize.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr("initialize")
self._bdh.initialize.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get(self):
self._bdh.get = Mock()
self._bdh.get.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr("get")
self._bdh.get.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_set(self):
self._bdh.set = Mock()
self._bdh.set.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr("set")
self._bdh.set.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_params(self):
self._bdh.get_resource_params = Mock()
self._bdh.get_resource_params.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr("get_resource_params")
self._bdh.get_resource_params.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_commands(self):
self._bdh.get_resource_commands = Mock()
self._bdh.get_resource_commands.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr("get_resource_commands")
self._bdh.get_resource_commands.assert_called_once()
示例3: TestBaseDataHandlerUnit
# 需要導入模塊: from ion.agents.data.handlers.base_data_handler import BaseDataHandler [as 別名]
# 或者: from ion.agents.data.handlers.base_data_handler.BaseDataHandler import cmd_dvr [as 別名]
#.........這裏部分代碼省略.........
gevent_mock.getcurrent = Mock()
_new_data_constraints_mock.return_value = None
_get_data_mock.return_value = data_generator
config = {}
publisher = Mock()
unlock_new_data_callback = Mock()
self.assertRaises(InstrumentParameterException, BaseDataHandler._acquire_data, config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback)
@patch('ion.agents.data.handlers.base_data_handler.EventPublisher')
@patch.object(BaseDataHandler, '_init_acquisition_cycle')
@patch.object(BaseDataHandler, '_get_data')
@patch.object(BaseDataHandler, '_publish_data')
def test__acquire_data_with_constraints_testing_flag(self, _publish_data_mock, _get_data_mock, _init_acquisition_cycle_mock, EventPublisher_mock):
granule1 = Mock(spec=Granule)
granule2 = Mock(spec=Granule)
granule3 = Mock(spec=Granule)
data_generator = [granule1, granule2, granule3]
_get_data_mock.return_value = data_generator
config = {'constraints' : 'test_constraints', 'TESTING':True}
publisher = Mock()
unlock_new_data_callback = Mock()
EventPublisher_mock.publish_event = Mock()
BaseDataHandler._acquire_data(config=config, publisher=publisher, unlock_new_data_callback=unlock_new_data_callback)
_init_acquisition_cycle_mock.assert_called_once_with(config)
_get_data_mock.assert_called_once_with(config)
_publish_data_mock.assert_called_once_with(publisher, data_generator)
EventPublisher_mock.publish_event.assert_called_once()
def test_cmd_dvr_initialize(self):
self._bdh.initialize = Mock()
self._bdh.initialize.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('initialize')
self._bdh.initialize.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get(self):
self._bdh.get = Mock()
self._bdh.get.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get')
self._bdh.get.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_set(self):
self._bdh.set = Mock()
self._bdh.set.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('set')
self._bdh.set.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_params(self):
self._bdh.get_resource_params = Mock()
self._bdh.get_resource_params.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get_resource_params')
self._bdh.get_resource_params.assert_called_once()
self.assertEquals(ret, sentinel.ret_val)
def test_cmd_dvr_get_resource_commands(self):
self._bdh.get_resource_commands = Mock()
self._bdh.get_resource_commands.return_value = sentinel.ret_val
ret = self._bdh.cmd_dvr('get_resource_commands')
self._bdh.get_resource_commands.assert_called_once()