Update tests to use multipart upload
This commit is contained in:
parent
e8ccfa8233
commit
d94c7fd8cd
2 changed files with 16 additions and 21 deletions
|
@ -99,15 +99,15 @@ class TestBase(unittest.TestCase):
|
||||||
""" Upload three test photos """
|
""" Upload three test photos """
|
||||||
album = cls.client.album.create(cls.TEST_ALBUM, visible=True)
|
album = cls.client.album.create(cls.TEST_ALBUM, visible=True)
|
||||||
photos = [
|
photos = [
|
||||||
cls.client.photo.upload_encoded("tests/test_photo1.jpg",
|
cls.client.photo.upload("tests/test_photo1.jpg",
|
||||||
title=cls.TEST_TITLE,
|
title=cls.TEST_TITLE,
|
||||||
tags=cls.TEST_TAG),
|
tags=cls.TEST_TAG),
|
||||||
cls.client.photo.upload_encoded("tests/test_photo2.jpg",
|
cls.client.photo.upload("tests/test_photo2.jpg",
|
||||||
title=cls.TEST_TITLE,
|
title=cls.TEST_TITLE,
|
||||||
tags=cls.TEST_TAG),
|
tags=cls.TEST_TAG),
|
||||||
cls.client.photo.upload_encoded("tests/test_photo3.jpg",
|
cls.client.photo.upload("tests/test_photo3.jpg",
|
||||||
title=cls.TEST_TITLE,
|
title=cls.TEST_TITLE,
|
||||||
tags=cls.TEST_TAG),
|
tags=cls.TEST_TAG),
|
||||||
]
|
]
|
||||||
# Remove the auto-generated month/year tags
|
# Remove the auto-generated month/year tags
|
||||||
tags_to_remove = [p for p in photos[0].tags if p != cls.TEST_TAG]
|
tags_to_remove = [p for p in photos[0].tags if p != cls.TEST_TAG]
|
||||||
|
|
|
@ -15,11 +15,11 @@ class TestPhotos(test_base.TestBase):
|
||||||
# Check that they're gone
|
# Check that they're gone
|
||||||
self.assertEqual(self.client.photos.list(), [])
|
self.assertEqual(self.client.photos.list(), [])
|
||||||
|
|
||||||
# Re-upload the photos
|
# Re-upload the photos, one of them using Bas64 encoding
|
||||||
ret_val = self.client.photo.upload_encoded("tests/test_photo1.jpg",
|
ret_val = self.client.photo.upload("tests/test_photo1.jpg",
|
||||||
title=self.TEST_TITLE)
|
title=self.TEST_TITLE)
|
||||||
self.client.photo.upload_encoded("tests/test_photo2.jpg",
|
self.client.photo.upload("tests/test_photo2.jpg",
|
||||||
title=self.TEST_TITLE)
|
title=self.TEST_TITLE)
|
||||||
self.client.photo.upload_encoded("tests/test_photo3.jpg",
|
self.client.photo.upload_encoded("tests/test_photo3.jpg",
|
||||||
title=self.TEST_TITLE)
|
title=self.TEST_TITLE)
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ class TestPhotos(test_base.TestBase):
|
||||||
""" Ensure that duplicate photos are rejected """
|
""" Ensure that duplicate photos are rejected """
|
||||||
# Attempt to upload a duplicate
|
# Attempt to upload a duplicate
|
||||||
with self.assertRaises(openphoto.OpenPhotoDuplicateError):
|
with self.assertRaises(openphoto.OpenPhotoDuplicateError):
|
||||||
self.client.photo.upload_encoded("tests/test_photo1.jpg",
|
self.client.photo.upload("tests/test_photo1.jpg",
|
||||||
title=self.TEST_TITLE)
|
title=self.TEST_TITLE)
|
||||||
|
|
||||||
# Check there are still three photos
|
# Check there are still three photos
|
||||||
self.photos = self.client.photos.list()
|
self.photos = self.client.photos.list()
|
||||||
|
@ -141,11 +141,6 @@ class TestPhotos(test_base.TestBase):
|
||||||
with self.assertRaises(openphoto.NotImplementedError):
|
with self.assertRaises(openphoto.NotImplementedError):
|
||||||
self.client.photo.replace_encoded(None, None)
|
self.client.photo.replace_encoded(None, None)
|
||||||
|
|
||||||
def test_upload(self):
|
|
||||||
""" If photo.upload gets implemented, write a test! """
|
|
||||||
with self.assertRaises(openphoto.NotImplementedError):
|
|
||||||
self.client.photo.upload(None)
|
|
||||||
|
|
||||||
def test_dynamic_url(self):
|
def test_dynamic_url(self):
|
||||||
""" If photo.dynamic_url gets implemented, write a test! """
|
""" If photo.dynamic_url gets implemented, write a test! """
|
||||||
with self.assertRaises(openphoto.NotImplementedError):
|
with self.assertRaises(openphoto.NotImplementedError):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue