Skip to content

Commit

Permalink
Merge pull request #44 from SanthoshBala18/develop
Browse files Browse the repository at this point in the history
Added auto_image functionality to ImageTransformationMixin
  • Loading branch information
bkwi committed Oct 1, 2019
2 parents aa10a76 + db55f3a commit 16fc2e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions filestack/mixins/imagetransformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def av_convert(self, *, preset=None, force=None, title=None, extname=None, filen
new_transform.url, uuid, timestamp, apikey=new_transform.apikey, security=new_transform.security
)

def auto_image(self):
return self._add_transform_task('auto_image', locals())

def _add_transform_task(self, transformation, params):
if isinstance(self, filestack.models.Transformation):
instance = self
Expand Down
6 changes: 6 additions & 0 deletions tests/transformation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,9 @@ def test_av_convert(post_mock, transform):
assert isinstance(new_av, AudioVisual)
assert new_av.uuid == 'someuuid'
assert new_av.timestamp == 'sometimestamp'


def test_auto_image(transform):
target_url = '{}/{}/auto_image/{}'.format(config.CDN_URL, APIKEY, EXTERNAL_URL)
auto_image = transform.auto_image()
assert auto_image.url == target_url

0 comments on commit 16fc2e8

Please sign in to comment.