コード例 #1
0
 def test_handle_non_unicode_char(self):
     """ Test handling a non-unicode character in subject or body """
     s = '€'
     msg = EmailMultiAlternatives(subject=s,
                                  body=s,
                                  to=['*****@*****.**'])
     _send_celery_mail(msg)
コード例 #2
0
    def test_tenant_setup_celery_reset(self):
        """ after _send_celery_mail finishes, the tenant should be cleared
            again """
        msg = mock.Mock()
        tenant = mock.Mock()

        _send_celery_mail(msg, tenant, send=False)

        self.assertFalse(hasattr(properties, 'tenant'))
        self.assertEquals(properties.tenant_properties, {})
コード例 #3
0
 def test_no_unicode_encode_error(self):
     """ Test handling a unicode character in subject or body """
     s = u'\u2019'
     msg = EmailMultiAlternatives(subject=s,
                                  body=s,
                                  to=['*****@*****.**'])
     try:
         _send_celery_mail(msg)
     except UnicodeEncodeError:
         self.fail("Unicode string not handled correctly")
コード例 #4
0
    def test_tenant_setup_celery_reset(self):
        """ after _send_celery_mail finishes, the tenant should be cleared
            again """
        msg = mock.Mock()
        tenant = mock.Mock()

        _send_celery_mail(msg, tenant, send=False)

        self.assertFalse(hasattr(properties, 'tenant'))
        self.assertEquals(properties.tenant_properties, {})
コード例 #5
0
    def test_tenant_setup_celery(self):
        """ verify that, once send() is called, a tenant has been setup """
        class interceptor(mock.Mock):
            tenant = None

            def send(self, *kw, **args):
                self.tenant = properties.tenant

        msg = interceptor()
        tenant = mock.Mock()

        _send_celery_mail(msg, tenant, send=True)

        self.assertTrue(msg.tenant is tenant)
コード例 #6
0
    def test_tenant_setup_celery(self):
        """ verify that, once send() is called, a tenant has been setup """

        class interceptor(mock.Mock):
            tenant = None

            def send(self, *kw, **args):
                self.tenant = properties.tenant

        msg = interceptor()
        tenant = mock.Mock()

        _send_celery_mail(msg, tenant, send=True)

        self.assertTrue(msg.tenant is tenant)