@@ -89,7 +89,7 @@ def _uploader(resize_size, final_size):
8989 with storage .open ("%s-%s.png" % (dest_name , rsize )) as fp :
9090 dest_image = Image .open (fp )
9191 dest_image .load ()
92-
92+
9393 # Assert that the width is always identical.
9494 eq_ (dest_image .size [0 ], fsize [0 ])
9595 # Assert that the height can be a wee bit fuzzy.
@@ -106,7 +106,7 @@ def _uploader(resize_size, final_size):
106106 with storage .open (dest .name ) as fp :
107107 dest_image = Image .open (fp )
108108 dest_image .load ()
109-
109+
110110 # Assert that the width is always identical.
111111 eq_ (dest_image .size [0 ], final_size [0 ])
112112 # Assert that the height can be a wee bit fuzzy.
@@ -124,7 +124,7 @@ def test_resize_image_asset():
124124 src_image = Image .open (fp )
125125 eq_ (src_image .size , original_size )
126126
127- dest = tempfile .NamedTemporaryFile (mode = 'r+w+b' , suffix = " .png" )
127+ dest = tempfile .NamedTemporaryFile (mode = 'r+w+b' , suffix = ' .png' )
128128 # Make it resize to some arbitrary size that's larger on both sides than
129129 # the source image. This is where the behavior differs from resize_image.
130130 tasks .resize_imageasset (img , dest .name , (500 , 500 ), locally = True )
@@ -195,7 +195,6 @@ def _mock_hide_64px_icon(path, *args, **kwargs):
195195
196196class TestGenerateImageAssets (amo .tests .TestCase ):
197197 """Test that image assets get generated properly."""
198-
199198 fixtures = ['webapps/337141-steamcube' ]
200199
201200 def setUp (self ):
@@ -213,6 +212,20 @@ def test_generated_image_assets(self):
213212 im .load ()
214213 eq_ (im .size , asset ['size' ])
215214
215+ def test_generated_image_assets_slug (self ):
216+ # We're going to generate assets for only one type.
217+ asset = APP_IMAGE_SIZES [0 ]
218+ slug = asset ['slug' ]
219+
220+ tasks .generate_image_assets (self .app , slug = slug )
221+ ia = ImageAsset .objects .filter (addon = self .app )
222+ eq_ (list (a .slug for a in ia ), [slug ])
223+
224+ with storage .open (ia [0 ].image_path ) as fp :
225+ im = Image .open (fp )
226+ im .load ()
227+ eq_ (im .size , asset ['size' ])
228+
216229 @mock .patch ('django.core.files.storage.default_storage.open' ,
217230 _mock_hide_64px_icon )
218231 def test_use_64 (self ):
0 commit comments