Run all tests at all API versions

This commit is contained in:
sneakypete81 2013-04-20 11:48:58 +01:00
parent afde3b2231
commit 9cbbd1bd47
8 changed files with 37 additions and 2 deletions

View file

View file

@ -0,0 +1,10 @@
from tests import test_albums, test_photos, test_tags
class TestAlbumsV1(test_albums.TestAlbums):
api_version = 1
class TestPhotosV1(test_photos.TestPhotos):
api_version = 1
class TestTagsV1(test_tags.TestTags):
api_version = 1

View file

@ -0,0 +1,10 @@
from tests import test_albums, test_photos, test_tags
class TestAlbumsV2(test_albums.TestAlbums):
api_version = 2
class TestPhotosV2(test_photos.TestPhotos):
api_version = 2
class TestTagsV2(test_tags.TestTags):
api_version = 2

View file

@ -3,6 +3,7 @@ import openphoto
import test_base
class TestAlbums(test_base.TestBase):
testcase_name = "album API"
def test_create_delete(self):
""" Create an album then delete it """

View file

@ -22,6 +22,8 @@ class TestBase(unittest.TestCase):
TEST_TAG = "test_tag"
TEST_ALBUM = "test_album"
MAXIMUM_TEST_PHOTOS = 4 # Never have more the 4 photos on the test server
testcase_name = "(unknown testcase)"
api_version = None
def __init__(self, *args, **kwds):
unittest.TestCase.__init__(self, *args, **kwds)
@ -36,9 +38,15 @@ class TestBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
""" Ensure there is nothing on the server before running any tests """
if cls.api_version is None:
print "\nTesting Latest %s" % cls.testcase_name
else:
print "\nTesting %s v%d" % (cls.testcase_name, cls.api_version)
cls.client = openphoto.OpenPhoto(tokens.host,
tokens.consumer_key, tokens.consumer_secret,
tokens.token, tokens.token_secret)
tokens.token, tokens.token_secret,
cls.api_version)
if cls.client.photos.list() != []:
raise ValueError("The test server (%s) contains photos. "

View file

@ -4,6 +4,8 @@ import openphoto
import test_base
class TestFramework(test_base.TestBase):
testcase_name = "framework"
def setUp(self):
"""Override the default setUp, since we don't need a populated database"""
logging.info("\nRunning %s..." % self.id())

View file

@ -3,6 +3,8 @@ import openphoto
import test_base
class TestPhotos(test_base.TestBase):
testcase_name = "photo API"
def test_delete_upload(self):
""" Test photo deletion and upload """
# Delete one photo using the OpenPhoto class, passing in the id

View file

@ -3,6 +3,8 @@ import openphoto
import test_base
class TestTags(test_base.TestBase):
testcase_name = "tag API"
@unittest.expectedFailure # Tag create fails - Issue #927
# NOTE: the below has not been tested/debugged, since it fails at the first step
def test_create_delete(self, tag_name="create_tag"):