def test_process_main_one(self, mock_load, mock_process_main): sources = { 'A': Mock(id='A', dict=Mock(return_value={'A': 1})), 'B': Mock(id='B', dict=Mock(return_value={'B': 2})), 'C': Mock(id='C', dict=Mock(return_value={'C': 3})), } mock_load.return_value = sources conduit = ContentSourcesConduit('task_id') step = ContentSourcesRefreshStep(conduit, content_source_id='C') step.process() step.process_main.assert_called_with(item=sources['C']) self.assertEquals(step.progress_successes, 1)
def test_process_main_one(self, mock_load, mock_process_main): sources = { 'A': Mock(id='A', dict=Mock(return_value={'A': 1})), 'B': Mock(id='B', dict=Mock(return_value={'B': 2})), 'C': Mock(id='C', dict=Mock(return_value={'C': 3})), } mock_load.return_value = sources conduit = ContentSourcesConduit('task_id') step = ContentSourcesRefreshStep(conduit, content_source_id='C') step.process() step.process_main.assert_called_with(item=sources['C']) self.assertEquals(step.progress_successes, 1)
def test_process_main_all(self, mock_load, mock_process_main): sources = { 'A': Mock(id='A', dict=Mock(return_value={'A': 1})), 'B': Mock(id='B', dict=Mock(return_value={'B': 2})), 'C': Mock(id='C', dict=Mock(return_value={'C': 3})), } mock_load.return_value = sources conduit = ContentSourcesConduit('task_id') step = ContentSourcesRefreshStep(conduit) step.process() expected_call_list = [] for item in step.get_iterator(): expected_call_list.append(call(item=item)) self.assertEqual(expected_call_list, step.process_main.call_args_list) self.assertEquals(step.progress_successes, 3)
def test_process_main_all(self, mock_load, mock_process_main): sources = { 'A': Mock(id='A', dict=Mock(return_value={'A': 1})), 'B': Mock(id='B', dict=Mock(return_value={'B': 2})), 'C': Mock(id='C', dict=Mock(return_value={'C': 3})), } mock_load.return_value = sources conduit = ContentSourcesConduit('task_id') step = ContentSourcesRefreshStep(conduit) step.process() expected_call_list = [] for item in step.get_iterator(): expected_call_list.append(call(item=item)) self.assertEqual(expected_call_list, step.process_main.call_args_list) self.assertEquals(step.progress_successes, 3)