|
@ -1,4 +1,3 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com> |
|
|
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com> |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
@ -50,10 +49,6 @@ class TestMailTracking(TransactionCase): |
|
|
http.request = self.last_request |
|
|
http.request = self.last_request |
|
|
return super(TestMailTracking, self).tearDown(*args, **kwargs) |
|
|
return super(TestMailTracking, self).tearDown(*args, **kwargs) |
|
|
|
|
|
|
|
|
def test_email_lower(self): |
|
|
|
|
|
self.recipient.write({'email': 'UPPER@example.com'}) |
|
|
|
|
|
self.assertEqual('upper@example.com', self.recipient.email) |
|
|
|
|
|
|
|
|
|
|
|
def test_empty_email(self): |
|
|
def test_empty_email(self): |
|
|
self.recipient.write({'email_bounced': True}) |
|
|
self.recipient.write({'email_bounced': True}) |
|
|
self.recipient.write({'email': False}) |
|
|
self.recipient.write({'email': False}) |
|
@ -61,7 +56,6 @@ class TestMailTracking(TransactionCase): |
|
|
self.assertEqual(False, self.recipient.email_bounced) |
|
|
self.assertEqual(False, self.recipient.email_bounced) |
|
|
self.recipient.write({'email_bounced': True}) |
|
|
self.recipient.write({'email_bounced': True}) |
|
|
self.recipient.write({'email': ''}) |
|
|
self.recipient.write({'email': ''}) |
|
|
self.assertEqual(False, self.recipient.email) |
|
|
|
|
|
self.assertEqual(False, self.recipient.email_bounced) |
|
|
self.assertEqual(False, self.recipient.email_bounced) |
|
|
self.assertEqual( |
|
|
self.assertEqual( |
|
|
False, |
|
|
False, |
|
@ -303,6 +297,15 @@ class TestMailTracking(TransactionCase): |
|
|
self.assertEqual('bounced', tracking.state) |
|
|
self.assertEqual('bounced', tracking.state) |
|
|
self.assertEqual(0.0, self.recipient.email_score) |
|
|
self.assertEqual(0.0, self.recipient.email_score) |
|
|
|
|
|
|
|
|
|
|
|
def test_bounce_new_partner(self): |
|
|
|
|
|
mail, tracking = self.mail_send(self.recipient.email) |
|
|
|
|
|
tracking.event_create('hard_bounce', {}) |
|
|
|
|
|
new_partner = self.env['res.partner'].create({ |
|
|
|
|
|
'name': 'Test New Partner', |
|
|
|
|
|
}) |
|
|
|
|
|
new_partner.email = self.recipient.email |
|
|
|
|
|
self.assertTrue(new_partner.email_bounced) |
|
|
|
|
|
|
|
|
def test_recordset_email_score(self): |
|
|
def test_recordset_email_score(self): |
|
|
"""For backwords compatibility sake""" |
|
|
"""For backwords compatibility sake""" |
|
|
trackings = self.env['mail.tracking.email'] |
|
|
trackings = self.env['mail.tracking.email'] |
|
|