Merge pull request #117 from jmathai/add-tests-to-elodiepy-gh-108
gh-108 Add tests to elodie.update_time
This commit is contained in:
commit
162aeaada8
|
@ -109,7 +109,7 @@ def test_update_location_on_audio():
|
|||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status, status
|
||||
assert status == True, status
|
||||
assert metadata['latitude'] != metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['latitude'], 37.3688305556), metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['longitude'], -122.03635), metadata_processed['longitude']
|
||||
|
@ -134,7 +134,7 @@ def test_update_location_on_photo():
|
|||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status, status
|
||||
assert status == True, status
|
||||
assert metadata['latitude'] != metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['latitude'], 37.36883), metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['longitude'], -122.03635), metadata_processed['longitude']
|
||||
|
@ -159,7 +159,7 @@ def test_update_location_on_text():
|
|||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status, status
|
||||
assert status == True, status
|
||||
assert metadata['latitude'] != metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['latitude'], 37.36883), metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['longitude'], -122.03635), metadata_processed['longitude']
|
||||
|
@ -187,11 +187,113 @@ def test_update_location_on_video():
|
|||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status, status
|
||||
assert status == True, status
|
||||
assert metadata['latitude'] != metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['latitude'], 37.3688305556), metadata_processed['latitude']
|
||||
assert helper.isclose(metadata_processed['longitude'], -122.03635), metadata_processed['longitude']
|
||||
|
||||
def test_update_time_on_audio():
|
||||
if not can_edit_exif():
|
||||
raise SkipTest('avmetareadwrite executable not found')
|
||||
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/audio.m4a' % folder
|
||||
shutil.copyfile(helper.get_file('audio.m4a'), origin)
|
||||
|
||||
audio = Audio(origin)
|
||||
metadata = audio.get_metadata()
|
||||
|
||||
reset_hash_db()
|
||||
status = elodie.update_time(audio, origin, '2000-01-01 12:00:00')
|
||||
restore_hash_db()
|
||||
|
||||
audio_processed = Audio(origin)
|
||||
metadata_processed = audio_processed.get_metadata()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status == True, status
|
||||
assert metadata['date_taken'] != metadata_processed['date_taken']
|
||||
assert metadata_processed['date_taken'] == helper.time_convert((2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed['date_taken']
|
||||
|
||||
def test_update_time_on_photo():
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/plain.jpg' % folder
|
||||
shutil.copyfile(helper.get_file('plain.jpg'), origin)
|
||||
|
||||
photo = Photo(origin)
|
||||
metadata = photo.get_metadata()
|
||||
|
||||
reset_hash_db()
|
||||
status = elodie.update_time(photo, origin, '2000-01-01 12:00:00')
|
||||
restore_hash_db()
|
||||
|
||||
photo_processed = Photo(origin)
|
||||
metadata_processed = photo_processed.get_metadata()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status == True, status
|
||||
assert metadata['date_taken'] != metadata_processed['date_taken']
|
||||
assert metadata_processed['date_taken'] == helper.time_convert((2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed['date_taken']
|
||||
|
||||
def test_update_time_on_text():
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/text.txt' % folder
|
||||
shutil.copyfile(helper.get_file('text.txt'), origin)
|
||||
|
||||
text = Text(origin)
|
||||
metadata = text.get_metadata()
|
||||
|
||||
reset_hash_db()
|
||||
status = elodie.update_time(text, origin, '2000-01-01 12:00:00')
|
||||
restore_hash_db()
|
||||
|
||||
text_processed = Text(origin)
|
||||
metadata_processed = text_processed.get_metadata()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status == True, status
|
||||
assert metadata['date_taken'] != metadata_processed['date_taken']
|
||||
assert metadata_processed['date_taken'] == helper.time_convert((2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed['date_taken']
|
||||
|
||||
def test_update_time_on_video():
|
||||
if not can_edit_exif():
|
||||
raise SkipTest('avmetareadwrite executable not found')
|
||||
|
||||
temporary_folder, folder = helper.create_working_folder()
|
||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||
|
||||
origin = '%s/video.mov' % folder
|
||||
shutil.copyfile(helper.get_file('video.mov'), origin)
|
||||
|
||||
video = Video(origin)
|
||||
metadata = video.get_metadata()
|
||||
|
||||
reset_hash_db()
|
||||
status = elodie.update_time(video, origin, '2000-01-01 12:00:00')
|
||||
restore_hash_db()
|
||||
|
||||
video_processed = Video(origin)
|
||||
metadata_processed = video_processed.get_metadata()
|
||||
|
||||
shutil.rmtree(folder)
|
||||
shutil.rmtree(folder_destination)
|
||||
|
||||
assert status == True, status
|
||||
assert metadata['date_taken'] != metadata_processed['date_taken']
|
||||
assert metadata_processed['date_taken'] == helper.time_convert((2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed['date_taken']
|
||||
|
||||
def reset_hash_db():
|
||||
hash_db = constants.hash_db
|
||||
if os.path.isfile(hash_db):
|
||||
|
|
Loading…
Reference in New Issue