1919)
2020
2121INVALID_LOGO_OPACITY_VALUES = (
22- pytest .param (0.0 , id = "zero " ),
22+ pytest .param (- 0.1 , id = "below-min " ),
2323 pytest .param (1.1 , id = "above-max" ),
2424)
2525
@@ -501,6 +501,7 @@ def test_live_sign_pdf_invalid_logo_opacity(
501501 "signature_configuration" : _to_json_string (
502502 {
503503 "type" : "new" ,
504+ "name" : "live-invalid-logo-opacity" ,
504505 "location" : make_signature_location (),
505506 "logo_opacity" : invalid_logo_opacity ,
506507 }
@@ -509,6 +510,46 @@ def test_live_sign_pdf_invalid_logo_opacity(
509510 )
510511
511512
513+ def test_live_sign_pdf_logo_opacity_zero_is_allowed (
514+ pdfrest_api_key : str ,
515+ pdfrest_live_base_url : str ,
516+ uploaded_pdf_for_signing : PdfRestFile ,
517+ uploaded_pfx_credential : PdfRestFile ,
518+ uploaded_passphrase : PdfRestFile ,
519+ ) -> None :
520+ with PdfRestClient (
521+ api_key = pdfrest_api_key ,
522+ base_url = pdfrest_live_base_url ,
523+ ) as client :
524+ response = client .sign_pdf (
525+ uploaded_pdf_for_signing ,
526+ signature_configuration = {
527+ "type" : "new" ,
528+ "name" : "live-logo-opacity-zero" ,
529+ "location" : make_signature_location (),
530+ },
531+ credentials = {
532+ "pfx" : uploaded_pfx_credential ,
533+ "passphrase" : uploaded_passphrase ,
534+ },
535+ extra_body = {
536+ "signature_configuration" : _to_json_string (
537+ {
538+ "type" : "new" ,
539+ "name" : "live-logo-opacity-zero" ,
540+ "location" : make_signature_location (),
541+ "logo_opacity" : 0.0 ,
542+ }
543+ )
544+ },
545+ output = "live-logo-opacity-zero" ,
546+ )
547+
548+ assert response .output_file .type == "application/pdf"
549+ assert response .output_file .name == "live-logo-opacity-zero.pdf"
550+ assert str (uploaded_pdf_for_signing .id ) in response .input_ids
551+
552+
512553@pytest .mark .asyncio
513554async def test_live_async_sign_pdf_invalid_signature_configuration (
514555 pdfrest_api_key : str ,
@@ -601,9 +642,51 @@ async def test_live_async_sign_pdf_invalid_logo_opacity(
601642 "signature_configuration" : _to_json_string (
602643 {
603644 "type" : "new" ,
645+ "name" : "live-async-invalid-logo-opacity" ,
604646 "location" : make_signature_location (),
605647 "logo_opacity" : invalid_logo_opacity ,
606648 }
607649 )
608650 },
609651 )
652+
653+
654+ @pytest .mark .asyncio
655+ async def test_live_async_sign_pdf_logo_opacity_zero_is_allowed (
656+ pdfrest_api_key : str ,
657+ pdfrest_live_base_url : str ,
658+ uploaded_pdf_for_signing : PdfRestFile ,
659+ uploaded_pfx_credential : PdfRestFile ,
660+ uploaded_passphrase : PdfRestFile ,
661+ ) -> None :
662+ async with AsyncPdfRestClient (
663+ api_key = pdfrest_api_key ,
664+ base_url = pdfrest_live_base_url ,
665+ ) as client :
666+ response = await client .sign_pdf (
667+ uploaded_pdf_for_signing ,
668+ signature_configuration = {
669+ "type" : "new" ,
670+ "name" : "live-async-logo-opacity-zero" ,
671+ "location" : make_signature_location (),
672+ },
673+ credentials = {
674+ "pfx" : uploaded_pfx_credential ,
675+ "passphrase" : uploaded_passphrase ,
676+ },
677+ extra_body = {
678+ "signature_configuration" : _to_json_string (
679+ {
680+ "type" : "new" ,
681+ "name" : "live-async-logo-opacity-zero" ,
682+ "location" : make_signature_location (),
683+ "logo_opacity" : 0.0 ,
684+ }
685+ )
686+ },
687+ output = "live-async-logo-opacity-zero" ,
688+ )
689+
690+ assert response .output_file .type == "application/pdf"
691+ assert response .output_file .name == "live-async-logo-opacity-zero.pdf"
692+ assert str (uploaded_pdf_for_signing .id ) in response .input_ids
0 commit comments