Add tests to verify unicode checkmark in file name is handled correctly. #226 (#227)

This commit is contained in:
Jaisen Mathai 2017-07-11 21:11:51 -07:00 committed by GitHub
parent 1535db5aa4
commit 00ba7e2604
1 changed files with 38 additions and 2 deletions

View File

@ -90,7 +90,43 @@ def test_import_file_video():
assert helper.path_tz_fix(os.path.join('2015-01-Jan','California','2015-01-19_12-45-11-video.mov')) in dest_path, dest_path assert helper.path_tz_fix(os.path.join('2015-01-Jan','California','2015-01-19_12-45-11-video.mov')) in dest_path, dest_path
def test_import_file_path_utf8_encoded_ascii(): def test_import_file_path_utf8_encoded_ascii_checkmark():
temporary_folder, folder = helper.create_working_folder()
temporary_folder_destination, folder_destination = helper.create_working_folder()
origin = text_type(folder)+u'/unicode\u2713filename.txt'
# encode the unicode string to ascii
origin = origin.encode('utf-8')
shutil.copyfile(helper.get_file('valid.txt'), origin)
helper.reset_dbs()
dest_path = elodie.import_file(origin, folder_destination, False, False, False)
helper.restore_dbs()
shutil.rmtree(folder)
shutil.rmtree(folder_destination)
assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
def test_import_file_path_unicode_checkmark():
temporary_folder, folder = helper.create_working_folder()
temporary_folder_destination, folder_destination = helper.create_working_folder()
origin = text_type(folder)+u'/unicode\u2713filename.txt'
shutil.copyfile(helper.get_file('valid.txt'), origin)
helper.reset_dbs()
dest_path = elodie.import_file(origin, folder_destination, False, False, False)
helper.restore_dbs()
shutil.rmtree(folder)
shutil.rmtree(folder_destination)
assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\u2713filename-sample-title.txt')) in dest_path, dest_path
def test_import_file_path_utf8_encoded_ascii_latin_nbsp():
temporary_folder, folder = helper.create_working_folder() temporary_folder, folder = helper.create_working_folder()
temporary_folder_destination, folder_destination = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder()
@ -109,7 +145,7 @@ def test_import_file_path_utf8_encoded_ascii():
assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\xa0filename-sample-title.txt')) in dest_path, dest_path assert helper.path_tz_fix(os.path.join('2016-04-Apr','London',u'2016-04-07_11-15-26-unicode\xa0filename-sample-title.txt')) in dest_path, dest_path
def test_import_file_path_unicode(): def test_import_file_path_unicode_latin_nbsp():
temporary_folder, folder = helper.create_working_folder() temporary_folder, folder = helper.create_working_folder()
temporary_folder_destination, folder_destination = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder()