def testCreateTemplate(self):
        with open(SignTest1File, 'rb') as sign_file:
            file_contents = sign_file.read()
        # create an envelope to be signed

        envelope_template = docusign.EnvelopeTemplate()
        envelope_template.email_subject = 'Please Sign my Python SDK Envelope (Embedded Signer)'
        envelope_template.email_blurb = 'Hello, Please sign my Python SDK Envelope.'

        # add a document to the template
        doc = docusign.Document()
        base64_doc = base64.b64encode(file_contents).decode("utf-8")
        doc.document_base64 = base64_doc
        doc.name = 'TestFile.pdf'
        doc.document_id = '1'
        envelope_template.documents = [doc]

        # Add a recipient to sign the document
        signer = docusign.Signer()
        signer.email = Username
        signer.name = 'Pat Developer'
        signer.recipient_id = '1'

        # Create a SignHere tab somewhere on the document for the signer to sign
        sign_here = docusign.SignHere()
        sign_here.document_id = '1'
        sign_here.page_number = '1'
        sign_here.recipient_id = '1'
        sign_here.x_position = '100'
        sign_here.y_position = '100'
        sign_here.scale_value = '0.5'

        tabs = docusign.Tabs()
        tabs.sign_here_tabs = [sign_here]
        signer.tabs = tabs

        recipients = docusign.Recipients()
        recipients.signers = [signer]
        envelope_template.recipients = recipients

        env_template_definition = docusign.EnvelopeTemplateDefinition()
        env_template_definition.name = 'myTemplate'
        envelope_template.envelope_template_definition = env_template_definition

        templates_api = TemplatesApi()

        try:

            template_summary = templates_api.create_template(
                self.user_info.accounts[0].account_id,
                envelope_template=envelope_template)
            assert template_summary is not None
            assert template_summary.template_id is not None

            print("TemplateSummary: ", end="")
            pprint(template_summary)

        except ApiException as e:
            print("\nException when calling DocuSign API: %s" % e)
            assert e is None  # make the test case fail in case of an API exception
    def testCreateTemplate(self):
        with open(SignTest1File, 'rb') as sign_file:
            file_contents = sign_file.read()

        # Set properties
        email_subject = 'Please Sign my Python SDK Envelope (Embedded Signer)'
        email_blurb = 'Hello, Please sign my Python SDK Envelope.'

        # add a document to the template
        base64_doc = base64.b64encode(file_contents).decode("utf-8")
        name = 'TestFile.pdf'
        document_id = '1'
        doc = docusign.Document(document_base64=base64_doc,
                                name=name,
                                document_id=document_id)
        documents = [doc]

        # Add a recipient to sign the document
        email = Username
        name = 'Pat Developer'
        recipient_id = '1'

        # Create a SignHere tab somewhere on the document for the signer to sign
        sign_document_id = '1'
        sign_page_number = '1'
        sign_recipient_id = '1'
        sign_x_position = '100'
        sign_y_position = '100'
        sign_scale_value = '0.5'
        sign_here = docusign.SignHere(document_id=sign_document_id,
                                      page_number=sign_page_number,
                                      recipient_id=sign_recipient_id,
                                      x_position=sign_x_position,
                                      y_position=sign_y_position,
                                      scale_value=sign_scale_value)

        sign_here_tabs = [sign_here]
        tabs = docusign.Tabs(sign_here_tabs=sign_here_tabs)
        signer = docusign.Signer(email=email,
                                 name=name,
                                 recipient_id=recipient_id,
                                 tabs=tabs)

        signers = [signer]
        recipients = docusign.Recipients(signers=signers)
        template_name = 'myTemplate'

        # Create the Envelope template
        envelope_template = docusign.EnvelopeTemplate(
            email_subject=email_subject,
            email_blurb=email_blurb,
            documents=documents,
            recipients=recipients,
            name=template_name)

        templates_api = TemplatesApi()

        try:

            template_summary = templates_api.create_template(
                self.user_info.accounts[0].account_id,
                envelope_template=envelope_template)
            assert template_summary is not None
            assert template_summary.template_id is not None

            print("TemplateSummary: ", end="")
            pprint(template_summary)

        except ApiException as e:
            print("\nException when calling DocuSign API: %s" % e)
            assert e is None  # make the test case fail in case of an API exception