@@ 1022-1045 (lines=24) @@ | ||
1019 | shutil.rmtree(folder) |
|
1020 | shutil.rmtree(os.path.dirname(os.path.dirname(destination))) |
|
1021 | ||
1022 | @mock.patch('elodie.config.config_file', '%s/config.ini-plugin-throw-error' % gettempdir()) |
|
1023 | def test_process_file_with_plugin_throw_error(): |
|
1024 | with open('%s/config.ini-plugin-throw-error' % gettempdir(), 'w') as f: |
|
1025 | f.write(""" |
|
1026 | [Plugins] |
|
1027 | plugins=ThrowError |
|
1028 | """) |
|
1029 | ||
1030 | if hasattr(load_config, 'config'): |
|
1031 | del load_config.config |
|
1032 | ||
1033 | filesystem = FileSystem() |
|
1034 | temporary_folder, folder = helper.create_working_folder() |
|
1035 | ||
1036 | origin = os.path.join(folder,'plain.jpg') |
|
1037 | shutil.copyfile(helper.get_file('plain.jpg'), origin) |
|
1038 | ||
1039 | media = Photo(origin) |
|
1040 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
1041 | ||
1042 | if hasattr(load_config, 'config'): |
|
1043 | del load_config.config |
|
1044 | ||
1045 | assert destination is None, destination |
|
1046 | ||
1047 | @mock.patch('elodie.config.config_file', '%s/config.ini-plugin-runtime-error' % gettempdir()) |
|
1048 | def test_process_file_with_plugin_runtime_error(): |
|
@@ 1047-1069 (lines=23) @@ | ||
1044 | ||
1045 | assert destination is None, destination |
|
1046 | ||
1047 | @mock.patch('elodie.config.config_file', '%s/config.ini-plugin-runtime-error' % gettempdir()) |
|
1048 | def test_process_file_with_plugin_runtime_error(): |
|
1049 | with open('%s/config.ini-plugin-runtime-error' % gettempdir(), 'w') as f: |
|
1050 | f.write(""" |
|
1051 | [Plugins] |
|
1052 | plugins=RuntimeError |
|
1053 | """) |
|
1054 | if hasattr(load_config, 'config'): |
|
1055 | del load_config.config |
|
1056 | ||
1057 | filesystem = FileSystem() |
|
1058 | temporary_folder, folder = helper.create_working_folder() |
|
1059 | ||
1060 | origin = os.path.join(folder,'plain.jpg') |
|
1061 | shutil.copyfile(helper.get_file('plain.jpg'), origin) |
|
1062 | ||
1063 | media = Photo(origin) |
|
1064 | destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) |
|
1065 | ||
1066 | if hasattr(load_config, 'config'): |
|
1067 | del load_config.config |
|
1068 | ||
1069 | assert '2015-12-Dec/Unknown Location/2015-12-05_00-59-26-plain.jpg' in destination, destination |
|
1070 | ||
1071 | def test_set_utime_with_exif_date(): |
|
1072 | filesystem = FileSystem() |