Example #1
0
    def test_serialize_signer(self):
        tab = SignHereTab(
            documentId=1,
            pageNumber=2,
            xPosition=100,
            yPosition=200)
        signer = Signer(
            clientUserId='some ID in your DB',
            email='*****@*****.**',
            name='My Name',
            recipientId=1,
            tabs=[tab])
        self.assertEqual(signer.to_dict(), {
            'clientUserId': 'some ID in your DB',
            'email': '*****@*****.**',
            'emailNotification': None,
            'name': 'My Name',
            'recipientId': 1,
            'routingOrder': 0,
            'tabs': {
                'signHereTabs': [tab.to_dict()],
            },
            'accessCode': None,
        })

        tab = ApproveTab(
            documentId=1,
            pageNumber=2,
            xPosition=100,
            yPosition=200)
        signer = Signer(
            clientUserId='some ID in your DB',
            email='*****@*****.**',
            emailSubject=u'Subject',
            emailBody=u'Body',
            supportedLanguage='de',
            name='My Name',
            recipientId=1,
            routingOrder=100,
            tabs=[tab],
            accessCode='toto')
        self.assertEqual(signer.to_dict(), {
            'clientUserId': 'some ID in your DB',
            'email': '*****@*****.**',
            'emailNotification': {
                'emailBody': u'Body',
                'emailSubject': u'Subject',
                'supportedLanguage': 'de',
            },
            'name': 'My Name',
            'recipientId': 1,
            'routingOrder': 100,
            'tabs': {
                'approveTabs': [tab.to_dict()],
            },
            'accessCode': 'toto',
        })
Example #2
0
    def test_serialize_signer(self):
        tab = SignHereTab(documentId=1,
                          pageNumber=2,
                          xPosition=100,
                          yPosition=200)
        signer = Signer(clientUserId='some ID in your DB',
                        email='*****@*****.**',
                        name='My Name',
                        recipientId=1,
                        tabs=[tab])
        self.assertEqual(
            signer.to_dict(), {
                'clientUserId': 'some ID in your DB',
                'email': '*****@*****.**',
                'emailNotification': None,
                'name': 'My Name',
                'recipientId': 1,
                'routingOrder': 0,
                'tabs': {
                    'signHereTabs': [tab.to_dict()],
                },
                'accessCode': None,
            })

        tab = ApproveTab(documentId=1,
                         pageNumber=2,
                         xPosition=100,
                         yPosition=200)
        signer = Signer(clientUserId='some ID in your DB',
                        email='*****@*****.**',
                        emailSubject=u'Subject',
                        emailBody=u'Body',
                        supportedLanguage='de',
                        name='My Name',
                        recipientId=1,
                        routingOrder=100,
                        tabs=[tab],
                        accessCode='toto')
        self.assertEqual(
            signer.to_dict(), {
                'clientUserId': 'some ID in your DB',
                'email': '*****@*****.**',
                'emailNotification': {
                    'emailBody': u'Body',
                    'emailSubject': u'Subject',
                    'supportedLanguage': 'de',
                },
                'name': 'My Name',
                'recipientId': 1,
                'routingOrder': 100,
                'tabs': {
                    'approveTabs': [tab.to_dict()],
                },
                'accessCode': 'toto',
            })
Example #3
0
 def test_serialize_sign_here_tab(self):
     tab = SignHereTab(
         documentId=2,
         pageNumber=1,
         xPosition=100,
         yPosition=200)
     self.assertEqual(tab.to_dict(), {
         'documentId': 2,
         'recipientId': None,
         'pageNumber': 1,
         'xPosition': 100,
         'yPosition': 200,
     })
Example #4
0
 def test_serialize_sign_here_tab(self):
     tab = SignHereTab(documentId=2,
                       pageNumber=1,
                       xPosition=100,
                       yPosition=200)
     self.assertEqual(
         tab.to_dict(), {
             'documentId': 2,
             'recipientId': None,
             'pageNumber': 1,
             'xPosition': 100,
             'yPosition': 200,
         })
Example #5
0
    def test_serialize_envelope_with_signer(self):
        tab = SignHereTab(documentId=1,
                          pageNumber=1,
                          xPosition=100,
                          yPosition=100)
        signer = Signer(email='*****@*****.**',
                        name='My Name',
                        recipientId=1,
                        tabs=[tab])
        document = Document(documentId=2, name='document.pdf')
        envelope = Envelope(documents=[document],
                            emailBlurb='This is the email body',
                            emailSubject='This is the email subject',
                            recipients=[signer],
                            status=ENVELOPE_STATUS_DRAFT)
        self.assertEqual(
            envelope.to_dict(), {
                'documents': [document.to_dict()],
                'emailBlurb': 'This is the email body',
                'emailSubject': 'This is the email subject',
                'recipients': {
                    'signers': [signer.to_dict()],
                },
                'status': ENVELOPE_STATUS_DRAFT,
            })

        notification = EventNotification(url='fake')
        envelope.eventNotification = notification
        self.assertEqual(envelope.to_dict()['eventNotification'],
                         notification.to_dict())