Code Duplication    Length = 23-24 lines in 2 locations

elodie/tests/filesystem_test.py 2 locations

@@ 999-1022 (lines=24) @@
996
    shutil.rmtree(folder)
997
    shutil.rmtree(os.path.dirname(os.path.dirname(destination)))
998
999
@mock.patch('elodie.config.config_file', '%s/config.ini-plugin-throw-error' % gettempdir())
1000
def test_process_file_with_plugin_throw_error():
1001
    with open('%s/config.ini-plugin-throw-error' % gettempdir(), 'w') as f:
1002
        f.write("""
1003
[Plugins]
1004
plugins=ThrowError
1005
        """)
1006
1007
    if hasattr(load_config, 'config'):
1008
        del load_config.config
1009
1010
    filesystem = FileSystem()
1011
    temporary_folder, folder = helper.create_working_folder()
1012
1013
    origin = os.path.join(folder,'plain.jpg')
1014
    shutil.copyfile(helper.get_file('plain.jpg'), origin)
1015
1016
    media = Photo(origin)
1017
    destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
1018
1019
    if hasattr(load_config, 'config'):
1020
        del load_config.config
1021
1022
    assert destination is None, destination
1023
1024
@mock.patch('elodie.config.config_file', '%s/config.ini-plugin-runtime-error' % gettempdir())
1025
def test_process_file_with_plugin_runtime_error():
@@ 1024-1046 (lines=23) @@
1021
1022
    assert destination is None, destination
1023
1024
@mock.patch('elodie.config.config_file', '%s/config.ini-plugin-runtime-error' % gettempdir())
1025
def test_process_file_with_plugin_runtime_error():
1026
    with open('%s/config.ini-plugin-runtime-error' % gettempdir(), 'w') as f:
1027
        f.write("""
1028
[Plugins]
1029
plugins=RuntimeError
1030
        """)
1031
    if hasattr(load_config, 'config'):
1032
        del load_config.config
1033
1034
    filesystem = FileSystem()
1035
    temporary_folder, folder = helper.create_working_folder()
1036
1037
    origin = os.path.join(folder,'plain.jpg')
1038
    shutil.copyfile(helper.get_file('plain.jpg'), origin)
1039
1040
    media = Photo(origin)
1041
    destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
1042
1043
    if hasattr(load_config, 'config'):
1044
        del load_config.config
1045
1046
    assert '2015-12-Dec/Unknown Location/2015-12-05_00-59-26-plain.jpg' in destination, destination
1047
1048
def test_set_utime_with_exif_date():
1049
    filesystem = FileSystem()