Private (visible=False/True) albums are no longer supported.
Tag count is now returned as an integer Explicitly add test tags, rather than removing autogenerated tags
This commit is contained in:
parent
eeffec991f
commit
4ccdceb601
2 changed files with 10 additions and 22 deletions
|
@ -7,7 +7,7 @@ class TestAlbums(test_base.TestBase):
|
|||
def test_create_delete(self):
|
||||
""" Create an album then delete it """
|
||||
album_name = "create_delete_album"
|
||||
album = self.client.album.create(album_name, visible=True)
|
||||
album = self.client.album.create(album_name)
|
||||
|
||||
# Check the return value
|
||||
self.assertEqual(album.name, album_name)
|
||||
|
@ -20,7 +20,7 @@ class TestAlbums(test_base.TestBase):
|
|||
self.assertNotIn(album_name, [a.name for a in self.client.albums.list()])
|
||||
|
||||
# Create it again, and delete it using the Album object
|
||||
album = self.client.album.create(album_name, visible=True)
|
||||
album = self.client.album.create(album_name)
|
||||
album.delete()
|
||||
# Check that the album is now gone
|
||||
self.assertNotIn(album_name, [a.name for a in self.client.albums.list()])
|
||||
|
@ -61,18 +61,6 @@ class TestAlbums(test_base.TestBase):
|
|||
for photo in self.photos:
|
||||
self.assertIn(photo.id, [p.id for p in album.photos])
|
||||
|
||||
@unittest.expectedFailure # Private albums are not visible - issue #929
|
||||
def test_private(self):
|
||||
""" Test that private albums can be created, and are visible """
|
||||
# Create and check that the album now exists
|
||||
album_name = "private_album"
|
||||
album = self.client.album.create(album_name, visible=False)
|
||||
self.assertIn(album_name, [a.name for a in self.client.albums.list()])
|
||||
|
||||
# Delete and check that the album is now gone
|
||||
album.delete()
|
||||
self.assertNotIn(album_name, [a.name for a in self.client.albums.list()])
|
||||
|
||||
def test_form(self):
|
||||
""" If album.form gets implemented, write a test! """
|
||||
with self.assertRaises(openphoto.NotImplementedError):
|
||||
|
|
|
@ -61,6 +61,7 @@ class TestBase(unittest.TestCase):
|
|||
"""
|
||||
self.photos = self.client.photos.list()
|
||||
if len(self.photos) != 3:
|
||||
# print self.photos
|
||||
print "[Regenerating Photos]"
|
||||
if len(self.photos) > 0:
|
||||
self._delete_all()
|
||||
|
@ -70,7 +71,7 @@ class TestBase(unittest.TestCase):
|
|||
self.tags = self.client.tags.list()
|
||||
if (len(self.tags) != 1 or
|
||||
self.tags[0].id != self.TEST_TAG or
|
||||
self.tags[0].count != "3"):
|
||||
self.tags[0].count != 3):
|
||||
print "[Regenerating Tags]"
|
||||
self._delete_all()
|
||||
self._create_test_photos()
|
||||
|
@ -97,22 +98,21 @@ class TestBase(unittest.TestCase):
|
|||
@classmethod
|
||||
def _create_test_photos(cls):
|
||||
""" Upload three test photos """
|
||||
album = cls.client.album.create(cls.TEST_ALBUM, visible=True)
|
||||
album = cls.client.album.create(cls.TEST_ALBUM)
|
||||
photos = [
|
||||
cls.client.photo.upload_encoded("tests/test_photo1.jpg",
|
||||
title=cls.TEST_TITLE,
|
||||
tags=cls.TEST_TAG),
|
||||
albums=album.id),
|
||||
cls.client.photo.upload_encoded("tests/test_photo2.jpg",
|
||||
title=cls.TEST_TITLE,
|
||||
tags=cls.TEST_TAG),
|
||||
albums=album.id),
|
||||
cls.client.photo.upload_encoded("tests/test_photo3.jpg",
|
||||
title=cls.TEST_TITLE,
|
||||
tags=cls.TEST_TAG),
|
||||
albums=album.id),
|
||||
]
|
||||
# Remove the auto-generated month/year tags
|
||||
tags_to_remove = [p for p in photos[0].tags if p != cls.TEST_TAG]
|
||||
# Add the test tag, removing any autogenerated tags
|
||||
for photo in photos:
|
||||
photo.update(tagsRemove=tags_to_remove, albums=album.id)
|
||||
photo.update(tags=cls.TEST_TAG)
|
||||
|
||||
@classmethod
|
||||
def _delete_all(cls):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue