gh-84 Added tests for invalid files with valid file extensions
This commit is contained in:
parent
47bd57d40d
commit
e35e0ce471
|
@ -181,6 +181,18 @@ def test_get_folder_path_with_location_and_title():
|
|||
|
||||
assert path == os.path.join('2015-12-Dec','Sunnyvale'), path
|
||||
|
||||
def test_process_file_invalid():
|
||||
filesystem = FileSystem()
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
|
||||
origin = os.path.join(folder,'photo.jpg')
|
||||
shutil.copyfile(helper.get_file('invalid.jpg'), origin)
|
||||
|
||||
media = Photo(origin)
|
||||
destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
|
||||
|
||||
assert destination is None
|
||||
|
||||
def test_process_file_plain():
|
||||
filesystem = FileSystem()
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
|
|
|
@ -53,6 +53,12 @@ def test_is_not_valid():
|
|||
|
||||
assert not photo.is_valid()
|
||||
|
||||
def test_get_metadata_of_invalid_photo():
|
||||
photo = Photo(helper.get_file('invalid.jpg'))
|
||||
metadata = photo.get_metadata()
|
||||
|
||||
assert metadata is None
|
||||
|
||||
def test_get_coordinate_default():
|
||||
photo = Photo(helper.get_file('with-location.jpg'))
|
||||
coordinate = photo.get_coordinate()
|
||||
|
|
Loading…
Reference in New Issue