Ejemplo n.º 1
0
    def test_serialize_envelope_with_role(self):
        role = Role(
            email='*****@*****.**',
            name='My Name',
            roleName='Role 1')
        envelope = Envelope(
            emailBlurb='This is the email body',
            emailSubject='This is the email subject',
            templateId='1111-2222-3333-4444',
            templateRoles=[role],
            status=ENVELOPE_STATUS_DRAFT)
        self.assertEqual(envelope.to_dict(), {
            'emailBlurb': 'This is the email body',
            'emailSubject': 'This is the email subject',
            'templateId': '1111-2222-3333-4444',
            'templateRoles': [
                role.to_dict()
            ],
            'status': ENVELOPE_STATUS_DRAFT,
        })

        notification = EventNotification(url='fake')
        envelope.eventNotification = notification
        self.assertEqual(
            envelope.to_dict()['eventNotification'], notification.to_dict())
Ejemplo n.º 2
0
    def test_serialize_role(self):
        role = Role(
            clientUserId='some ID in your DB',
            email='*****@*****.**',
            name='My Name',
            roleName='Role 1')
        self.assertEqual(role.to_dict(), {
            'clientUserId': 'some ID in your DB',
            'email': '*****@*****.**',
            'emailNotification': None,
            'name': 'My Name',
            'roleName': 'Role 1',
        })

        role = Role(
            clientUserId='some ID in your DB',
            email='*****@*****.**',
            emailSubject=u'Subject',
            emailBody=u'Body',
            supportedLanguage='de',
            name='My Name',
            roleName='Role 1')
        self.assertEqual(role.to_dict(), {
            'clientUserId': 'some ID in your DB',
            'email': '*****@*****.**',
            'emailNotification': {
                'emailBody': u'Body',
                'emailSubject': u'Subject',
                'supportedLanguage': 'de',
            },
            'name': 'My Name',
            'roleName': 'Role 1',
        })
Ejemplo n.º 3
0
    def test_serialize_role(self):
        role = Role(clientUserId='some ID in your DB',
                    email='*****@*****.**',
                    name='My Name',
                    roleName='Role 1')
        self.assertEqual(
            role.to_dict(), {
                'clientUserId': 'some ID in your DB',
                'email': '*****@*****.**',
                'emailNotification': None,
                'name': 'My Name',
                'roleName': 'Role 1',
            })

        role = Role(clientUserId='some ID in your DB',
                    email='*****@*****.**',
                    emailSubject=u'Subject',
                    emailBody=u'Body',
                    supportedLanguage='de',
                    name='My Name',
                    roleName='Role 1')
        self.assertEqual(
            role.to_dict(), {
                'clientUserId': 'some ID in your DB',
                'email': '*****@*****.**',
                'emailNotification': {
                    'emailBody': u'Body',
                    'emailSubject': u'Subject',
                    'supportedLanguage': 'de',
                },
                'name': 'My Name',
                'roleName': 'Role 1',
            })
Ejemplo n.º 4
0
    def test_serialize_envelope_with_role(self):
        role = Role(email='*****@*****.**',
                    name='My Name',
                    roleName='Role 1')
        envelope = Envelope(emailBlurb='This is the email body',
                            emailSubject='This is the email subject',
                            templateId='1111-2222-3333-4444',
                            templateRoles=[role],
                            status=ENVELOPE_STATUS_DRAFT)
        self.assertEqual(
            envelope.to_dict(), {
                'emailBlurb': 'This is the email body',
                'emailSubject': 'This is the email subject',
                'templateId': '1111-2222-3333-4444',
                'templateRoles': [role.to_dict()],
                'status': ENVELOPE_STATUS_DRAFT,
            })

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