Try to put the test environment back the way we found it,

to save teardown/setup time.
This commit is contained in:
sneakypete81 2013-09-10 18:04:49 +01:00
parent d2e621935a
commit 76f27a7dbb
3 changed files with 13 additions and 1 deletions

View file

@ -26,6 +26,10 @@ class TestActivities(test_base.TestBase):
for activity in activities: for activity in activities:
self.assertIn(activity.data.id, [photo.id for photo in photos]) self.assertIn(activity.data.id, [photo.id for photo in photos])
# Put the environment back the way we found it
for photo in photos:
photo.update(tags=self.TEST_TAG)
def test_list_filter(self): def test_list_filter(self):
""" """
Check that the activity list filter parameter works correctly Check that the activity list filter parameter works correctly
@ -43,6 +47,10 @@ class TestActivities(test_base.TestBase):
self.assertEqual(len(upload_activities), len(photos)) self.assertEqual(len(upload_activities), len(photos))
self.assertEqual(len(update_activities), 1) self.assertEqual(len(update_activities), 1)
# Put the environment back the way we found it
for photo in photos:
photo.update(tags=self.TEST_TAG)
# The purge endpoint currently reports a 500: Internal Server Error # The purge endpoint currently reports a 500: Internal Server Error
# PHP Fatal error: # PHP Fatal error:
# Call to undefined method DatabaseMySql::postActivitiesPurge() # Call to undefined method DatabaseMySql::postActivitiesPurge()

View file

@ -63,6 +63,7 @@ class TestAlbums(test_base.TestBase):
"update_cover was introduced in APIv2") "update_cover was introduced in APIv2")
def test_update_cover(self): def test_update_cover(self):
""" Test that an album cover can be updated """ """ Test that an album cover can be updated """
self.albums[0].cover_update(self.photos[0])
self.assertNotEqual(self.albums[0].cover.id, self.photos[1].id) self.assertNotEqual(self.albums[0].cover.id, self.photos[1].id)
self.albums[0].cover_update(self.photos[1]) self.albums[0].cover_update(self.photos[1])
self.assertEqual(self.albums[0].cover.id, self.photos[1].id) self.assertEqual(self.albums[0].cover.id, self.photos[1].id)
@ -102,3 +103,6 @@ class TestAlbums(test_base.TestBase):
self.assertNotIn(self.photos[0].id, [p.id for p in album.photos]) self.assertNotIn(self.photos[0].id, [p.id for p in album.photos])
self.assertIn(self.photos[1].id, [p.id for p in album.photos]) self.assertIn(self.photos[1].id, [p.id for p in album.photos])
self.assertIn(self.photos[2].id, [p.id for p in album.photos]) self.assertIn(self.photos[2].id, [p.id for p in album.photos])
# Put the environment back the way we found it
album.add(self.photos[0])

View file

@ -89,7 +89,7 @@ class TestTags(test_base.TestBase):
# TODO: Un-skip this test once issue #919 is resolved - # TODO: Un-skip this test once issue #919 is resolved -
# tags with double-slashes cannot be deleted # tags with double-slashes cannot be deleted
@unittest.expectedFailure @unittest.skip("Tags with double-slashed cannot be deleted")
def test_tag_with_double_slashes(self): def test_tag_with_double_slashes(self):
""" Run test_create_delete using a tag containing double-slashes """ """ Run test_create_delete using a tag containing double-slashes """
self.test_create_delete("tag//with//double//slashes") self.test_create_delete("tag//with//double//slashes")