def test_walk_document_applies_all_step_runners_again_if_they_were_already_run(self):
     step_runner1 = mock.MagicMock()
     p = PreProcessPipeline([step_runner1], [])
     doc = object()
     p.walk_document(doc)
     p.walk_document(doc)
     self.assertEqual(step_runner1.call_count, 2)
Example #2
0
 def test_walk_document_applies_all_step_runners_again_if_they_were_already_run(
         self):
     step_runner1 = mock.MagicMock()
     p = PreProcessPipeline([step_runner1], [])
     doc = object()
     p.walk_document(doc)
     p.walk_document(doc)
     self.assertEqual(step_runner1.call_count, 2)
Example #3
0
 def test_walk_document_applies_all_step_runners_to_the_given_doc(self):
     step1_runner = mock.MagicMock()
     step1_runner.side_effect = lambda x: x.call_order.append(1)
     step2_runner = mock.MagicMock()
     step2_runner.side_effect = lambda x: x.call_order.append(2)
     doc = mock.MagicMock()
     doc.call_order = []
     p = PreProcessPipeline([step1_runner, step2_runner], [])
     p.walk_document(doc)
     step1_runner.assert_called_once_with(doc)
     step2_runner.assert_called_once_with(doc)
     self.assertEqual(doc.call_order, [1, 2])
 def test_walk_document_applies_all_step_runners_to_the_given_doc(self):
     step1_runner = mock.MagicMock()
     step1_runner.side_effect = lambda x: x.call_order.append(1)
     step2_runner = mock.MagicMock()
     step2_runner.side_effect = lambda x: x.call_order.append(2)
     doc = mock.MagicMock()
     doc.call_order = []
     p = PreProcessPipeline([step1_runner, step2_runner], [])
     p.walk_document(doc)
     step1_runner.assert_called_once_with(doc)
     step2_runner.assert_called_once_with(doc)
     self.assertEqual(doc.call_order, [1, 2])
Example #5
0
 def test_walk_document_itself_does_not_save_the_document(self):
     step_runner1 = mock.MagicMock()
     p = PreProcessPipeline([step_runner1], [])
     doc = mock.MagicMock()
     p.walk_document(doc)
     self.assertEqual(doc.save.call_count, 0)
 def test_walk_document_itself_does_not_save_the_document(self):
     step_runner1 = mock.MagicMock()
     p = PreProcessPipeline([step_runner1], [])
     doc = mock.MagicMock()
     p.walk_document(doc)
     self.assertEqual(doc.save.call_count, 0)