gh-93 Add tests for RW2 files
gh-94 Skip test for writing to RW2 files because they are not supported
This commit is contained in:
parent
4c269b538a
commit
1c0372141f
|
@ -342,3 +342,58 @@ def test_set_metadata_on_dng():
|
||||||
assert metadata['date_taken'] == helper.time_convert((2009, 10, 20, 9, 10, 46, 1, 293, 0)), metadata['date_taken']
|
assert metadata['date_taken'] == helper.time_convert((2009, 10, 20, 9, 10, 46, 1, 293, 0)), metadata['date_taken']
|
||||||
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
|
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
|
||||||
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
|
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
|
||||||
|
|
||||||
|
def test_get_metadata_from_rw2():
|
||||||
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
|
|
||||||
|
photo_file = helper.get_file('photo.rw2')
|
||||||
|
origin = '%s/photo.rw2' % folder
|
||||||
|
|
||||||
|
if not photo_file:
|
||||||
|
photo_file = helper.download_file('photo.rw2', folder)
|
||||||
|
if not photo_file or not os.path.isfile(photo_file):
|
||||||
|
raise SkipTest('rw2 file not downlaoded')
|
||||||
|
|
||||||
|
# downloading for each test is costly so we save it in the working directory
|
||||||
|
file_path_save_as = helper.get_file_path('photo.rw2')
|
||||||
|
if os.path.isfile(photo_file):
|
||||||
|
shutil.copyfile(photo_file, file_path_save_as)
|
||||||
|
|
||||||
|
shutil.copyfile(photo_file, origin)
|
||||||
|
|
||||||
|
photo = Photo(origin)
|
||||||
|
metadata = photo.get_metadata()
|
||||||
|
|
||||||
|
shutil.rmtree(folder)
|
||||||
|
|
||||||
|
assert metadata['date_taken'] == helper.time_convert((2014, 11, 19, 23, 7, 44, 2, 323, 0)), metadata['date_taken']
|
||||||
|
|
||||||
|
def test_set_metadata_on_rw2():
|
||||||
|
raise SkipTest('gh-94 Writing to RW2 images is not supported')
|
||||||
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
|
|
||||||
|
photo_file = helper.get_file('photo.rw2')
|
||||||
|
origin = '%s/photo.rw2' % folder
|
||||||
|
|
||||||
|
if not photo_file:
|
||||||
|
photo_file = helper.download_file('photo.rw2', folder)
|
||||||
|
if not photo_file or not os.path.isfile(photo_file):
|
||||||
|
raise SkipTest('rw2 file not downlaoded')
|
||||||
|
|
||||||
|
shutil.copyfile(photo_file, origin)
|
||||||
|
|
||||||
|
photo = Photo(origin)
|
||||||
|
origin_metadata = photo.get_metadata()
|
||||||
|
|
||||||
|
status = photo.set_location(11.1111111111, 99.9999999999)
|
||||||
|
|
||||||
|
assert status == True, status
|
||||||
|
|
||||||
|
photo_new = Photo(origin)
|
||||||
|
metadata = photo_new.get_metadata()
|
||||||
|
|
||||||
|
shutil.rmtree(folder)
|
||||||
|
|
||||||
|
assert metadata['date_taken'] == helper.time_convert((2014, 11, 19, 23, 7, 44, 2, 323, 0)), metadata['date_taken']
|
||||||
|
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
|
||||||
|
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
|
||||||
|
|
Loading…
Reference in New Issue