gh-121 Add test to check --trash argument (#165)
This commit is contained in:
parent
5dc31cf46f
commit
0c1aa2954e
|
@ -5,8 +5,6 @@ General file system methods.
|
|||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
from json import dumps
|
||||
|
||||
from elodie import constants
|
||||
|
|
|
@ -141,6 +141,40 @@ def test_import_file_allow_duplicate_true():
|
|||
assert dest_path2 is not None
|
||||
assert dest_path1 == dest_path2
|
||||
|
||||
def test_import_file_send_to_trash_false():
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/valid.txt' % folder
|
||||
shutil.copyfile(helper.get_file('valid.txt'), origin)
|
||||
|
||||
reset_hash_db()
|
||||
dest_path1 = elodie.import_file(origin, folder_destination, False, False, False)
|
||||
assert os.path.isfile(origin), origin
|
||||
restore_hash_db()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert dest_path1 is not None
|
||||
|
||||
def test_import_file_send_to_trash_true():
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/valid.txt' % folder
|
||||
shutil.copyfile(helper.get_file('valid.txt'), origin)
|
||||
|
||||
reset_hash_db()
|
||||
dest_path1 = elodie.import_file(origin, folder_destination, False, True, False)
|
||||
assert not os.path.isfile(origin), origin
|
||||
restore_hash_db()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert dest_path1 is not None
|
||||
|
||||
def test_import_destination_in_source():
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
folder_destination = '{}/destination'.format(folder)
|
||||
|
|
Loading…
Reference in New Issue