def test_update_envelope_recipients(self): client = DocuSignTestClient() with mock.patch.object(client, 'put') as put_mock: signers = [ Signer(clientUserId='userid_2', email='*****@*****.**', name='Signer 2'), Signer(clientUserId='userid_2', email='*****@*****.**', name='Signer 2'), ] client.update_envelope_recipients('ABC123', signers) url = '/accounts/{account_id}/envelopes/ABC123/recipients'.format( account_id=client.account_id) put_mock.assert_called_once_with( url, data={'signers': [signers[0].to_dict(), signers[1].to_dict()]}) with mock.patch.object(client, 'put') as put_mock: client.update_envelope_recipients('ABC123', [], resend_envelope=True) put_mock.assert_called_once_with( '/accounts/{}/envelopes/ABC123/recipients' '?resend_envelope=true'.format(client.account_id), data={'signers': []})
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())
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())
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', })
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', })