def test_has_album(): photo = Photo(helper.get_file('with-album.jpg')) album = photo.get_album() assert album == 'Test Album', album
def test_is_valid(): photo = Photo(helper.get_file('plain.jpg')) assert photo.is_valid()
def test_pillow_not_loaded(): photo = Photo(helper.get_file('imghdr-error.jpg')) photo.pillow = None assert photo.is_valid() == False
def test_empty_album(): photo = Photo(helper.get_file('plain.jpg')) assert photo.get_album() is None
def test_get_folder_path_with_title(): filesystem = FileSystem() media = Photo(helper.get_file('with-title.jpg')) path = filesystem.get_folder_path(media.get_metadata()) assert path == os.path.join('2015-12-Dec', 'Unknown Location'), path
def test_get_file_name_with_title(): filesystem = FileSystem() media = Photo(helper.get_file('with-title.jpg')) file_name = filesystem.get_file_name(media.get_metadata()) assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-with-title-some-title.jpg'), file_name
def test_get_camera_model(): photo = Photo(helper.get_file('with-location.jpg')) model = photo.get_camera_model() assert model == 'Canon EOS REBEL T2i', model
def test_get_coordinate_default(): photo = Photo(helper.get_file('with-location.jpg')) coordinate = photo.get_coordinate() assert helper.isclose(coordinate, 37.3667027222), coordinate
def test_get_camera_make(): photo = Photo(helper.get_file('with-location.jpg')) make = photo.get_camera_make() assert make == 'Canon', make
def test_get_camera_make_not_set(): photo = Photo(helper.get_file('no-exif.jpg')) make = photo.get_camera_make() assert make is None, make
def test_get_coordinate_longitude_plus(): photo = Photo(helper.get_file('with-location-inv.jpg')) coordinate = photo.get_coordinate('longitude') assert helper.isclose(coordinate, 122.033383611), coordinate
def test_get_file_name_with_uppercase_and_spaces(): filesystem = FileSystem() media = Photo(helper.get_file('Plain With Spaces And Uppercase 123.jpg')) file_name = filesystem.get_file_name(media.get_metadata()) assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-plain-with-spaces-and-uppercase-123.jpg'), file_name
def test_get_file_name_with_original_name_title_exif(): filesystem = FileSystem() media = Photo(helper.get_file('with-filename-and-title-in-exif.jpg')) file_name = filesystem.get_file_name(media.get_metadata()) assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-foobar-foobar-title.jpg'), file_name
def test_is_not_valid(): photo = Photo(helper.get_file('text.txt')) assert not photo.is_valid()
def test_get_camera_model_not_set(): photo = Photo(helper.get_file('no-exif.jpg')) model = photo.get_camera_model() assert model is None, model
def test_get_metadata_of_invalid_photo(): photo = Photo(helper.get_file('invalid.jpg')) metadata = photo.get_metadata() assert metadata is None
def test_is_valid(): photo = Photo(helper.get_file('with-location.jpg')) assert photo.is_valid()
def test_get_coordinate_latitude_minus(): photo = Photo(helper.get_file('with-location-inv.jpg')) coordinate = photo.get_coordinate('latitude') assert helper.isclose(coordinate, -37.3667027222), coordinate
def test_is_valid_fallback_using_pillow(): photo = Photo(helper.get_file('imghdr-error.jpg')) assert photo.is_valid()
def test_get_folder_path_with_location(): filesystem = FileSystem() media = Photo(helper.get_file('with-location.jpg')) path = filesystem.get_folder_path(media.get_metadata()) assert path == os.path.join('2015-12-Dec', 'Sunnyvale'), path
def test_get_file_name_plain(): filesystem = FileSystem() media = Photo(helper.get_file('plain.jpg')) file_name = filesystem.get_file_name(media.get_metadata()) assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-plain.jpg'), file_name