def test_should_call_download_function_3_times(self, *args): pyrallelize.pyrallelize([ 'http://www.google.com/', 'http://www.github.com/', 'http://www.facebook.com/' ]) param = multiprocessing.pool.Pool.call_args_list[0][0][0] self.assertEqual(multiprocessing.pool.Pool.call_count, 1) self.assertEqual(param, 3)
def test_should_receive_receive_correct_value_passed_on_directory_parameter(self, *args): pyrallelize.pyrallelize('http://www.google.com/', 'dir_test/') self.assertEqual(pyrallelize._download.call_count, 1) pyrallelize._download.assert_called_with('http://www.google.com/', 'dir_test/')
def test_should_call_download_function_without_create_processes_when_parameter_is_a_string(self, *args): pyrallelize.pyrallelize('http://www.google.com/') self.assertEqual(pyrallelize._download.call_count, 1) pyrallelize._download.assert_called_with('http://www.google.com/', '')