@@ -121,6 +121,27 @@ def uploaded_20_page_pdf(
121121 return client .files .create_from_paths ([resource ])[0 ]
122122
123123
124+ def test_live_convert_to_png_success (
125+ pdfrest_api_key : str ,
126+ pdfrest_live_base_url : str ,
127+ ) -> None :
128+ resource = get_test_resource_path ("report.pdf" )
129+ with PdfRestClient (
130+ api_key = pdfrest_api_key ,
131+ base_url = pdfrest_live_base_url ,
132+ ) as client :
133+ uploaded = client .files .create_from_paths ([resource ])[0 ]
134+ response = client .convert_to_png (
135+ uploaded ,
136+ output_prefix = "live-png" ,
137+ resolution = 150 ,
138+ )
139+
140+ assert response .output_files
141+ assert all (file_info .type == "image/png" for file_info in response .output_files )
142+ assert str (response .input_id ) == str (uploaded .id )
143+
144+
124145@pytest .mark .asyncio
125146async def test_live_async_convert_to_png_success (
126147 pdfrest_api_key : str ,
@@ -292,21 +313,29 @@ def test_live_graphic_invalid_smoothing(
292313
293314
294315@pytest .mark .asyncio
316+ @pytest .mark .parametrize (
317+ ("_endpoint_label" , "spec" , "invalid_smoothing" ),
318+ _invalid_smoothing_cases (),
319+ )
295320async def test_live_async_graphic_invalid_smoothing (
296321 pdfrest_api_key : str ,
297322 pdfrest_live_base_url : str ,
323+ _endpoint_label : str ,
324+ spec : _GraphicEndpointSpec ,
325+ invalid_smoothing : Any ,
298326) -> None :
299327 resource = get_test_resource_path ("report.pdf" )
300328 async with AsyncPdfRestClient (
301329 api_key = pdfrest_api_key ,
302330 base_url = pdfrest_live_base_url ,
303331 ) as client :
304332 uploaded = (await client .files .create_from_paths ([resource ]))[0 ]
333+ client_method = getattr (client , spec .method_name )
305334 with pytest .raises (PdfRestApiError , match = r"(?i)smooth" ):
306- await client . convert_to_png (
335+ await client_method (
307336 uploaded ,
308337 smoothing = "none" ,
309- extra_body = {"smoothing" : "super-smooth" },
338+ extra_body = {"smoothing" : invalid_smoothing },
310339 )
311340
312341
0 commit comments