def test_main(self, dir_path, input_path, output_path, get_files, save_csv_file, config): dir_path.return_value = self.data_path input_path.return_value = self.data_path output_path.return_value = self.data_path get_files.return_value = [self.file_path] save_csv_file.side_effect = None main(['process_viajes_data', 'input'])
def test_main_with_s3(self, dir_path, input_path, get_files, p_data, save_csv_file, send_s3): send_s3.side_effect = mock.MagicMock() dir_path.return_value = 'dir' input_path.return_value = 'input' get_files.return_value = [ os.path.join(self.data_path, '2020-03-01.viaje') ] save_csv_file.side_effect = None main(['process_viajes_data', 'input', '--send-to-s3'])
def test_main_with_lower_and_upper_bound(self, dir_path, input_path, output_path, get_files, p_data, save_csv_file, config): dir_path.return_value = self.data_path input_path.return_value = self.data_path output_path.return_value = self.data_path get_files.return_value = [ os.path.join(self.data_path, '2020-03-01.viaje') ] p_data.return_value = ['2020-03-01', '5930344'] save_csv_file.side_effect = None main([ 'process_viajes_data', 'input', '--lower-bound', '2019-10-01', '--upper-bound', '2020-01-01' ])
def test_main_with_upper_bound_only(self, dir_path, input_path, output_path, get_files, p_data, save_csv_file, config): dir_path.return_value = self.data_path input_path.return_value = self.data_path output_path.return_value = self.data_path get_files.return_value = [ os.path.join(self.data_path, '2020-03-01.viaje') ] p_data.return_value = [['2020-03-01', '420420']] save_csv_file.side_effect = None with self.assertRaises(SystemExit) as cm: main([ 'process_viajes_data', 'input', '--upper-bound', '2020-10-10' ])