Not that frontend issue 955 is resolved, we should use the return value of the transform API to replace the photo object's fields
This commit is contained in:
parent
ee3840de9f
commit
ea904e4337
3 changed files with 3 additions and 17 deletions
|
@ -111,6 +111,4 @@ class ApiPhoto:
|
|||
if not isinstance(photo, Photo):
|
||||
photo = Photo(self._client, {"id": photo})
|
||||
photo.transform(**kwds)
|
||||
# The API doesn't currently return the transformed photo
|
||||
# Uncomment the below once frontend issue #955 is resolved
|
||||
# return photo
|
||||
return photo
|
||||
|
|
|
@ -98,14 +98,12 @@ class Photo(OpenPhotoObject):
|
|||
|
||||
def transform(self, **kwds):
|
||||
"""
|
||||
Performs transformation specified in **kwds
|
||||
Performs transformation specified in **kwds
|
||||
Example: transform(rotate=90)
|
||||
"""
|
||||
new_dict = self._openphoto.post("/photo/%s/transform.json" % self.id,
|
||||
**kwds)["result"]
|
||||
# The API doesn't currently return the transformed photo
|
||||
# Uncomment the below once frontend issue #955 is resolved
|
||||
# self._replace_fields(new_dict)
|
||||
self._replace_fields(new_dict)
|
||||
|
||||
class Tag(OpenPhotoObject):
|
||||
def delete(self, **kwds):
|
||||
|
|
|
@ -151,18 +151,8 @@ class TestPhotos(test_base.TestBase):
|
|||
photo = self.photos[0]
|
||||
self.assertEqual(photo.rotation, "0")
|
||||
photo = self.client.photo.transform(photo, rotate=90)
|
||||
|
||||
# Need an explicit update, since transform API doesn't return the rotated photo
|
||||
# Remove the following line once Issue #955 is resolved
|
||||
photo = self.client.photo.view(self.photos[0])
|
||||
|
||||
self.assertEqual(photo.rotation, "90")
|
||||
|
||||
# Do the same using the Photo object directly
|
||||
photo.transform(rotate=90)
|
||||
|
||||
# Need an explicit update, since transform API doesn't return the rotated photo
|
||||
# Remove the following line once Issue #955 is resolved
|
||||
photo = self.client.photo.view(photo)
|
||||
|
||||
self.assertEqual(photo.rotation, "180")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue