def setUp(self): patcher1 = patch.object(storage.StorageWorker, 'store_event_or_sleep') self.addCleanup(patcher1.stop) self.mock_store = patcher1.start() self.mock_store.side_effect = [None] self.mock_signal = Mock() self.mock_signal.is_set.return_value = False self.worker = storage.StorageWorker(Mock(), Mock(), Mock(), self.mock_signal)
def setUp(self): patcher1 = patch.object(storage.StorageWorker, 'get_key_from_queue') patcher2 = patch.object(storage.StorageWorker, 'store_event_by_key') patcher3 = patch('time.sleep') self.addCleanup(patcher1.stop) self.addCleanup(patcher2.stop) self.addCleanup(patcher3.stop) self.mock_get_key_from_queue = patcher1.start() self.mock_store_event_by_key = patcher2.start() self.mock_sleep = patcher3.start() self.worker = storage.StorageWorker(Mock(), Mock(), Mock())
def setUp(self): patcher1 = patch.object(storage.StorageWorker, 'remove_event_from_queue') patcher2 = patch.object(storage.StorageWorker, 'get_event_by_key') patcher3 = patch.object(storage, 'logger') self.addCleanup(patcher1.stop) self.addCleanup(patcher2.stop) self.addCleanup(patcher3.stop) self.mock_remove_event = patcher1.start() self.mock_get_event_by_key = patcher2.start() self.mock_logger = patcher3.start() self.mock_datastore = Mock() self.worker = storage.StorageWorker(self.mock_datastore, Mock(), Mock())
def setUp(self): self.mock_kvstore = Mock() self.mock_queue = sentinel.queue self.worker = storage.StorageWorker(Mock(), self.mock_kvstore, self.mock_queue)
def setUp(self): self.worker = storage.StorageWorker(sentinel.datastore, sentinel.kvstore, sentinel.queue, sentinel.signal)