@@ -56,8 +56,8 @@ def return_file(request, uri, headers):
5656 response = b'copyrighted file'
5757 elif 'resize' in data :
5858 response = b'small file'
59- elif 'type ' in data :
60- response = b'transcoded file'
59+ elif 'convert ' in data :
60+ response = b'converted file'
6161 elif 'transform' in data :
6262 response = b'transformed file'
6363 else :
@@ -137,13 +137,13 @@ def test_transform_should_return_source_with_data(self):
137137 self .assertEqual (b'transformed file' , Source .from_buffer ('png file' ).transform (background = 'black' ).to_buffer ())
138138 self .assertJsonEqual ('{"transform":{"background":"black"}}' , httpretty .last_request ().body .decode ('utf-8' ))
139139
140- def test_transcode_should_return_source (self ):
141- self .assertIsInstance (Source .from_buffer ('png file' ).resize (width = 400 ).transcode ( ['image/webp' ]), Source )
140+ def test_convert_should_return_source (self ):
141+ self .assertIsInstance (Source .from_buffer ('png file' ).resize (width = 400 ).convert ( type = ['image/webp' ]), Source )
142142 self .assertEqual (b'png file' , httpretty .last_request ().body )
143143
144- def test_transcode_should_return_source_with_data (self ):
145- self .assertEqual (b'transcoded file' , Source .from_buffer ('png file' ).transcode ( 'image/jpg' ).to_buffer ())
146- self .assertJsonEqual ('{"type": "image/jpg"}' , httpretty .last_request ().body .decode ('utf-8' ))
144+ def test_convert_should_return_source_with_data (self ):
145+ self .assertEqual (b'converted file' , Source .from_buffer ('png file' ).convert ( type = 'image/jpg' ).to_buffer ())
146+ self .assertJsonEqual ('{"convert": {" type": "image/jpg"} }' , httpretty .last_request ().body .decode ('utf-8' ))
147147
148148 def test_store_should_return_result_meta (self ):
149149 self .assertIsInstance (Source .from_buffer ('png file' ).store (service = 's3' ), ResultMeta )
@@ -176,9 +176,9 @@ def test_to_file_with_file_object_should_store_image_data(self):
176176 def test_all_options_together (self ):
177177 self .assertEqual ('https://bucket.s3-region.amazonaws.com/some/location' ,
178178 Source .from_buffer ('png file' ).resize (width = 400 )\
179- .transcode ( ['image/webp' , 'image/png' ])\
179+ .convert ( type = ['image/webp' , 'image/png' ])\
180180 .transform (background = "black" )\
181181 .preserve ("copyright" , "location" )\
182182 .store (service = 's3' ).location )
183- self .assertJsonEqual ('{"store":{"service":"s3"},"resize":{"width":400},"preserve": ["copyright", "location"], "transform": {"background": "black"}, "type": ["image/webp", "image/png"]}' , httpretty .last_request ().body .decode ('utf-8' ))
183+ self .assertJsonEqual ('{"store":{"service":"s3"},"resize":{"width":400},"preserve": ["copyright", "location"], "transform": {"background": "black"}, "convert": {" type": ["image/webp", "image/png"]} }' , httpretty .last_request ().body .decode ('utf-8' ))
184184
0 commit comments