def test_scheduling_checkpoint_when_it_is_enabled(self): # mocking q = get_queue() mywriter = Writer(q) mywriter.schedule_checkpoint_writing = MagicMock() conf = {'checkpoint_enabled' : True, 'checkpoint_path' : self.checkpoint_path} mywriter.__init__(q, conf=conf) mywriter.schedule_checkpoint_writing.assert_called_with()
def test_initialization_calls(self): # mocking q = get_queue() mywriter = Writer(q) mywriter.set_conf = MagicMock() mywriter.setup = MagicMock() mywriter.schedule_tasks = MagicMock() conf = {'foo' : 'bar'} mywriter.__init__(q, conf=conf) # asserting that methods are called mywriter.set_conf.assert_called_with(conf) mywriter.setup.assert_called_with() mywriter.schedule_tasks.assert_called_with()