Run all tests at all API versions
This commit is contained in:
parent
afde3b2231
commit
9cbbd1bd47
8 changed files with 37 additions and 2 deletions
0
tests/api_versions/__init__.py
Normal file
0
tests/api_versions/__init__.py
Normal file
10
tests/api_versions/test_v1.py
Normal file
10
tests/api_versions/test_v1.py
Normal 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
|
10
tests/api_versions/test_v2.py
Normal file
10
tests/api_versions/test_v2.py
Normal 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
|
|
@ -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 """
|
||||
|
|
|
@ -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. "
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue