Merge remote-tracking branch 'upstream/master' into apiv2_frontend_bugfixes

ecially if it merges an updated upstream into a topic branch.
This commit is contained in:
sneakypete81 2013-04-02 21:31:48 +01:00
commit fcf43377dd
11 changed files with 125 additions and 28 deletions

View file

@ -1,4 +1,5 @@
import unittest
import logging
import openphoto
try:
@ -26,6 +27,12 @@ class TestBase(unittest.TestCase):
unittest.TestCase.__init__(self, *args, **kwds)
self.photos = []
LOG_FILENAME = "tests.log"
logging.basicConfig(filename="tests.log",
filemode="w",
format="%(message)s",
level=logging.INFO)
@classmethod
def setUpClass(cls):
""" Ensure there is nothing on the server before running any tests """
@ -95,20 +102,25 @@ class TestBase(unittest.TestCase):
print "Albums: %s" % self.albums
raise Exception("Album creation failed")
logging.info("\nRunning %s..." % self.id())
def tearDown(self):
logging.info("Finished %s\n" % self.id())
@classmethod
def _create_test_photos(cls):
""" Upload three test photos """
album = cls.client.album.create(cls.TEST_ALBUM)
photos = [
cls.client.photo.upload_encoded("tests/test_photo1.jpg",
title=cls.TEST_TITLE,
albums=album.id),
cls.client.photo.upload_encoded("tests/test_photo2.jpg",
title=cls.TEST_TITLE,
albums=album.id),
cls.client.photo.upload_encoded("tests/test_photo3.jpg",
title=cls.TEST_TITLE,
albums=album.id),
cls.client.photo.upload("tests/test_photo1.jpg",
title=cls.TEST_TITLE,
albums=album.id),
cls.client.photo.upload("tests/test_photo2.jpg",
title=cls.TEST_TITLE,
albums=album.id),
cls.client.photo.upload("tests/test_photo3.jpg",
title=cls.TEST_TITLE,
albums=album.id),
]
# Add the test tag, removing any autogenerated tags
for photo in photos: