Exemplo n.º 1
0
def test_has_album():
    photo = Photo(helper.get_file('with-album.jpg'))
    album = photo.get_album()

    assert album == 'Test Album', album
Exemplo n.º 2
0
def test_is_valid():
    photo = Photo(helper.get_file('plain.jpg'))

    assert photo.is_valid()
Exemplo n.º 3
0
def test_pillow_not_loaded():
    photo = Photo(helper.get_file('imghdr-error.jpg'))
    photo.pillow = None

    assert photo.is_valid() == False
Exemplo n.º 4
0
def test_empty_album():
    photo = Photo(helper.get_file('plain.jpg'))
    assert photo.get_album() is None
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
def test_get_coordinate_default():
    photo = Photo(helper.get_file('with-location.jpg'))
    coordinate = photo.get_coordinate()

    assert helper.isclose(coordinate, 37.3667027222), coordinate
Exemplo n.º 9
0
def test_get_camera_make():
    photo = Photo(helper.get_file('with-location.jpg'))
    make = photo.get_camera_make()

    assert make == 'Canon', make
Exemplo n.º 10
0
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
Exemplo n.º 11
0
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
Exemplo n.º 12
0
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
Exemplo n.º 13
0
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
Exemplo n.º 14
0
def test_is_not_valid():
    photo = Photo(helper.get_file('text.txt'))

    assert not photo.is_valid()
Exemplo n.º 15
0
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
Exemplo n.º 16
0
def test_get_metadata_of_invalid_photo():
    photo = Photo(helper.get_file('invalid.jpg'))
    metadata = photo.get_metadata()

    assert metadata is None
Exemplo n.º 17
0
def test_is_valid():
    photo = Photo(helper.get_file('with-location.jpg'))

    assert photo.is_valid()
Exemplo n.º 18
0
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
Exemplo n.º 19
0
def test_is_valid_fallback_using_pillow():
    photo = Photo(helper.get_file('imghdr-error.jpg'))

    assert photo.is_valid()
Exemplo n.º 20
0
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
Exemplo n.º 21
0
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