def album_with_random_images(album, random_set_of_images, random_1_to_50): album_obj = entities.Album(album) assert album_obj.image_count == 0 # Now add the images to the album album_obj.add_images(random_set_of_images) assert album_obj.image_count == random_1_to_50 yield album_obj.pkid
def test_album_image_ids(album_with_random_images, random_1_to_50): album_obj = entities.Album(album_with_random_images) image_ids = album_obj.image_ids assert len(image_ids) == random_1_to_50 for img_id in image_ids: assert isinstance(img_id, str) assert len(img_id) == 36
def album_with_20_images_and_sub_albums(album_with_20_images, frameset_with_6_frames): album_obj = entities.Album(album_with_20_images) fs = entities.Frameset(frameset_with_6_frames) # Assign the album to the fs fs.assign_album(album_obj) # verify that it now has sub_albums assert album_obj.sub_albums yield album_obj.pkid
def make_album(name, **kwargs): album = entities.Album(name=name, **kwargs) album.save() return album.pkid
def test_album_images(album_with_random_images, random_1_to_50): album_obj = entities.Album(album_with_random_images) images = album_obj.images assert len(images) == random_1_to_50 for img in images: assert isinstance(img, entities.Image)
def test_remove_image_from_album(album_with_random_images, random_set_of_images): album_obj = entities.Album(album_with_random_images) orig_count = album_obj.image_count image_id = random.choice(random_set_of_images) album_obj.remove_image(image_id) assert album_obj.image_count == orig_count - 1
def test_add_image_to_album(image, album_with_random_images): album_obj = entities.Album(album_with_random_images) orig_count = album_obj.image_count album_obj.add_image(image) assert album_obj.image_count == orig_count + 1
def album_with_20_images(album, set_of_20_images): album_obj = entities.Album(album) assert album_obj.image_count == 0 # Now add the images to the album album_obj.add_images(set_of_20_images) yield album_obj.pkid