def setUp(self): super(SchedulerManagerTestCase, self).setUp() self.periodic_tasks = [] def _periodic_task(*args, **kwargs): def decorator(f): self.periodic_tasks.append(f) return f return mock.Mock(side_effect=decorator) self.mock_periodic_task = self.mock_object( manager.periodic_task, 'periodic_task', mock.Mock(side_effect=_periodic_task)) reload(manager) self.flags(scheduler_driver=self.driver_cls_name) self.manager = manager.SchedulerManager() self.context = context.RequestContext('fake_user', 'fake_project') self.topic = 'fake_topic' self.fake_args = (1, 2, 3) self.fake_kwargs = {'cat': 'meow', 'dog': 'woof'}
def test_scheduler_driver_mapper(self, driver_class): test_manager = manager.SchedulerManager(scheduler_driver=driver_class) self.assertIsInstance(test_manager.driver, filter.FilterScheduler)