@@ -240,19 +240,19 @@ def test_upload_result(self) -> None:
240240 assert response .json ()["message" ] == "No worker permission."
241241
242242 for job in jobs :
243+ metadata = {}
244+ if "width" in job :
245+ metadata .update (width = job ["width" ])
246+ if "height" in job :
247+ metadata .update (height = job ["height" ])
248+ if "mimetype" in job :
249+ metadata .update (mimetype = job ["mimetype" ])
243250 if job ["job_type" ] == "ThumbnailJob" and not thumbnail_job_tested :
244251 # Test no metadata error
245252 response = self .upload_result (job , None , None )
246253 assert response .status_code == 422
247254
248255 # Test normal ThumbnailJob result upload
249- metadata = {}
250- if "width" in job :
251- metadata .update (width = job ["width" ])
252- if "height" in job :
253- metadata .update (height = job ["height" ])
254- if "mimetype" in job :
255- metadata .update (mimetype = job ["mimetype" ])
256256 response = self .upload_result (
257257 job = job ,
258258 data = None ,
@@ -269,23 +269,15 @@ def test_upload_result(self) -> None:
269269 response = self .upload_result (
270270 job = job ,
271271 data = None ,
272- metadata = json .dumps ({
273- "width" : job ["width" ],
274- "height" : job ["height" ],
275- "mimetype" : job ["mimetype" ],
276- }),
272+ metadata = json .dumps (metadata ),
277273 )
278274 assert response .status_code == 200
279275 image_conversion_job_tested = True
280276 if job ["job_type" ] == "ThumbnailSourceJob" and not thumbnail_source_job_tested :
281277 response = self .upload_result (
282278 job = job ,
283279 data = None ,
284- metadata = json .dumps ({
285- "width" : job ["width" ],
286- "height" : job ["height" ],
287- "mimetype" : job ["mimetype" ],
288- }),
280+ metadata = json .dumps (metadata ),
289281 )
290282 assert response .status_code == 200
291283 thumbnail_source_job_tested = True
0 commit comments