Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Sep 10, 2020
1 parent f1e005b commit 203c15a
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions tests/test_photoscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,12 @@ def test_photoslibrary_album_by_uuid(photoslib):


def test_photoslibrary_album_bad_name(photoslib):
import photoscript

album = photoslib.album("BAD_NAME")
assert album is None


def test_photoslibrary_album_bad_uuid(photoslib):
import photoscript

with pytest.raises(ValueError):
photoslib.album(uuid="BAD_UUID")
Expand Down Expand Up @@ -341,22 +339,22 @@ def test_photoslibrary_folder(photoslib):
assert subfolders[0].name == "SubFolder1"


def test_photoscript_folder_top_level(photoslib):
def test_photoslibrary_folder_top_level(photoslib):
import photoscript

folder = photoslib.folder("SubFolder1", top_level=True)
assert folder is None


def test_photoscript_folder_exception(photoslib):
def test_photoslibrary_folder_exception(photoslib):
""" test exceptions in folder() """
import photoscript

with pytest.raises(ValueError):
folder = photoslib.folder("Travel", uuid=FOLDER_UUID)


def test_photoscript_folder_by_uuid(photoslib):
def test_photoslibrary_folder_by_uuid(photoslib):
""" test getting folder by UUID """
import photoscript

Expand All @@ -372,6 +370,39 @@ def test_photoscript_folder_by_uuid(photoslib):
# photoslib.folder(uuid="BAD_UUID")


def test_photoslibrary_folder_by_path_1(photoslib):
import photoscript

folder = photoslib.folder_by_path(["Travel"])
assert isinstance(folder, photoscript.Folder)


def test_photoslibrary_folder_by_path_2(photoslib):
import photoscript

folder = photoslib.folder_by_path(["Folder1", "SubFolder1"])
assert isinstance(folder, photoscript.Folder)


def test_photoslibrary_folder_by_path_bad_path(photoslib):
import photoscript

folder = photoslib.folder_by_path(["Folder1", "SubFolder1", "I Don't Exist"])
assert folder is None


def test_photoslibrary_folders_top_level(photoslib):
folders = photoslib.folders()
folder_names = [folder.name for folder in folders]
assert sorted(folder_names) == sorted(FOLDER_NAMES_TOP)


def test_photoslibrary_folders_all(photoslib):
folders = photoslib.folders(top_level=False)
folder_names = [folder.name for folder in folders]
assert sorted(folder_names) == sorted(FOLDER_NAMES_ALL)


def test_photoslibrary_create_folder(photoslib):
import photoscript

Expand Down

0 comments on commit 203c15a

Please sign in to comment.