本文整理匯總了Python中catsnap.image_truck.ImageTruck.upload_resize方法的典型用法代碼示例。如果您正苦於以下問題:Python ImageTruck.upload_resize方法的具體用法?Python ImageTruck.upload_resize怎麽用?Python ImageTruck.upload_resize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類catsnap.image_truck.ImageTruck
的用法示例。
在下文中一共展示了ImageTruck.upload_resize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_upload_resize
# 需要導入模塊: from catsnap.image_truck import ImageTruck [as 別名]
# 或者: from catsnap.image_truck.ImageTruck import upload_resize [as 別名]
def test_upload_resize(self, calculate_filename, MockClient):
bucket = Mock()
key = Mock()
bucket.new_key.return_value = key
client = Mock()
client.bucket.return_value = bucket
MockClient.return_value = client
calculate_filename.return_value = 'faceb00c'
truck = ImageTruck('contentsoffile', 'image/gif', None)
truck.upload_resize('resizedcontents', 'small')
bucket.new_key.assert_called_with('faceb00c_small')
key.set_contents_from_string.assert_called_with('resizedcontents')
key.set_metadata.assert_called_with('Content-Type', 'image/gif')
key.make_public.assert_called_once()