Code Duplication    Length = 23-24 lines in 2 locations

elodie/tests/filesystem_test.py 2 locations

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