def test_enrichment_plugin_scheduler_task_config_error(self): celery_app = self._scheduler.start() celery_beat_service = Service(celery_app, max_interval=None, schedule_filename=None, scheduler_cls=PanoptesCeleryPluginScheduler) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH', self.panoptes_test_conf_file): mock_getmtime = MagicMock(side_effect=Exception) with patch('yahoo_panoptes.framework.plugins.panoptes_base_plugin.os.path.getmtime', mock_getmtime): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service)
def test_basic_operations(self): celery_app = self._scheduler.start() celery_beat_service = Service(celery_app, max_interval=None, schedule_filename=None, scheduler_cls=PanoptesCeleryPluginScheduler) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH', self.panoptes_test_conf_file): with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesResourceCache.get_resources', mock_get_resources): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service)
def test_error_messages(self): celery_app = self._scheduler.start() celery_beat_service = Service(celery_app, max_interval=None, schedule_filename=None, scheduler_cls=PanoptesCeleryPluginScheduler) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH', self.panoptes_test_conf_file): mock_plugin_manager = MagicMock(side_effect=Exception) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesPluginManager', mock_plugin_manager): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service)
def test_enrichment_plugin_scheduler_task_bad_plugin(self): celery_app = self._scheduler.start() celery_beat_service = Service(celery_app, max_interval=None, schedule_filename=None, scheduler_cls=PanoptesCeleryPluginScheduler) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH', self.panoptes_test_conf_file): with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesEnrichmentPluginInfo.' 'execute_frequency', 0): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesEnrichmentPluginInfo.' 'resource_filter', None): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service)
def test_resource_cache_error(self): celery_app = self._scheduler.start() celery_beat_service = Service(celery_app, max_interval=None, schedule_filename=None, scheduler_cls=PanoptesCeleryPluginScheduler) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH', self.panoptes_test_conf_file): mock_cache = MagicMock(side_effect=Exception) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesResourceCache', mock_cache): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service) mock_get_resources_exception = MagicMock(side_effect=Exception) with patch('yahoo_panoptes.enrichment.enrichment_plugin_scheduler.PanoptesResourceCache.get_resources', mock_get_resources_exception): start_enrichment_plugin_scheduler() enrichment_plugin_scheduler_task(celery_beat_service)