Browse Source

FIX mail_notify_bounce UnicodeDecodeError

also using real email messages for tests
pull/255/head
eLBati 7 years ago
committed by Holger Brunn
parent
commit
519a12b88f
  1. 2
      mail_notify_bounce/__manifest__.py
  2. 5
      mail_notify_bounce/models/mail_thread.py
  3. 57
      mail_notify_bounce/tests/data/bounce_message
  4. 148
      mail_notify_bounce/tests/data/bounce_message_2
  5. 16
      mail_notify_bounce/tests/test_mail_notify_bounce.py

2
mail_notify_bounce/__manifest__.py

@ -5,7 +5,7 @@
{ {
"name": "Notify bounce emails", "name": "Notify bounce emails",
"summary": "Notify bounce emails to preconfigured addresses", "summary": "Notify bounce emails to preconfigured addresses",
"version": "10.0.1.0.1",
"version": "10.0.1.0.2",
"category": "Mail", "category": "Mail",
"website": "https://github.com/OCA/social", "website": "https://github.com/OCA/social",
"author": "Agile Business Group, Odoo Community Association (OCA)", "author": "Agile Business Group, Odoo Community Association (OCA)",

5
mail_notify_bounce/models/mail_thread.py

@ -4,6 +4,7 @@
import logging import logging
from odoo import models, api, tools, _ from odoo import models, api, tools, _
from odoo.tools import ustr
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -59,9 +60,9 @@ class MailThread(models.AbstractModel):
'body_html': ( 'body_html': (
u"%s<br/><br/><br/>%s<br/><br/>%s" u"%s<br/><br/><br/>%s<br/><br/>%s"
% ( % (
message_dict['body'],
ustr(message_dict['body']),
_("Raw message:"), _("Raw message:"),
unicode(message.__str__(), errors='replace').replace(
ustr(message.__str__()).replace(
"\n", "<br/>") "\n", "<br/>")
)), )),
'subject': message_dict['subject'], 'subject': message_dict['subject'],

57
mail_notify_bounce/tests/data/bounce_message

@ -58,13 +58,15 @@ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
7jveCrDsnoeOf3Apx9hKqbEpaVY1j83ZXd8Xlgh3TKpaLWTkJ7kXpjWI1dtyoHu2gqDa 7jveCrDsnoeOf3Apx9hKqbEpaVY1j83ZXd8Xlgh3TKpaLWTkJ7kXpjWI1dtyoHu2gqDa
eAYNugD7LEf/Z4eqAscxDh1BGLoP08nnSuNOLFp2vSllOOJ9lrn4j+7oNh2kH5rqCo5p eAYNugD7LEf/Z4eqAscxDh1BGLoP08nnSuNOLFp2vSllOOJ9lrn4j+7oNh2kH5rqCo5p
Bsng== Bsng==
X-Gm-Message-State: AElRT7HLs9wf2hitIMHNLIfimcazh71cW/FEbkyUsTU7RxS/X/F91dLP 6bBRDO9/IVMugWthex/F5ETZimzvqruF11fKqp8mEQ==
X-Gm-Message-State: AElRT7HLs9wf2hitIMHNLIfimcazh71cW/FEbkyUsTU7RxS/X/F91dLP
6bBRDO9/IVMugWthex/F5ETZimzvqruF11fKqp8mEQ==
X-Google-Smtp-Source: AG47ELvXcyNHPl+/aUdcgG+CzQeXrs6eiMf+ZMiUhyKwChcSc4RVtQp8GCoTITDyrD8DFPmc3XUPXWoqXdygX6xt4XSc4Il/Zw+ygz4= X-Google-Smtp-Source: AG47ELvXcyNHPl+/aUdcgG+CzQeXrs6eiMf+ZMiUhyKwChcSc4RVtQp8GCoTITDyrD8DFPmc3XUPXWoqXdygX6xt4XSc4Il/Zw+ygz4=
X-Received: by 10.28.106.19 with SMTP id f19mr289852wmc.84.1520936712492; X-Received: by 10.28.106.19 with SMTP id f19mr289852wmc.84.1520936712492;
Tue, 13 Mar 2018 03:25:12 -0700 (PDT) Tue, 13 Mar 2018 03:25:12 -0700 (PDT)
Content-Type: multipart/report; boundary="089e082ce1a07949ad056748acaf"; report-type=delivery-status Content-Type: multipart/report; boundary="089e082ce1a07949ad056748acaf"; report-type=delivery-status
Return-Path: <> Return-Path: <>
Received: by 10.28.106.19 with SMTP id f19mr318417wmc.84; Tue, 13 Mar 2018 03:25:12 -0700 (PDT)
Received: by 10.28.106.19 with SMTP id f19mr318417wmc.84; Tue, 13 Mar 2018
03:25:12 -0700 (PDT)
From: Mail Delivery Subsystem <mailer-daemon@googlemail.com> From: Mail Delivery Subsystem <mailer-daemon@googlemail.com>
To: support@agilebg.com To: support@agilebg.com
Auto-Submitted: auto-replied Auto-Submitted: auto-replied
@ -88,7 +90,7 @@ Content-Transfer-Encoding: quoted-printable
** Indirizzo non trovato ** ** Indirizzo non trovato **
Il tuo messaggio per jj@jj.pink non è stato recapitato perchè il =
Il tuo messaggio per jj@jj.pink non =C3=A8 stato recapitato perch=C3=A9 il =
dominio jj.pink risulta inesistente. Verifica di non aver inserito errori d= dominio jj.pink risulta inesistente. Verifica di non aver inserito errori d=
i battitura o spazi superflui e riprova. i battitura o spazi superflui e riprova.
@ -130,7 +132,7 @@ Indirizzo non trovato
<tr><td style=3D"padding-top:20px;color:#757575;font-size:16px;font-weight:= <tr><td style=3D"padding-top:20px;color:#757575;font-size:16px;font-weight:=
normal;text-align:left"> normal;text-align:left">
Il tuo messaggio per <a style=3D'color:#212121;text-decoration:none'><b>jj@= Il tuo messaggio per <a style=3D'color:#212121;text-decoration:none'><b>jj@=
jj.pink</b></a> non è stato recapitato perchè il dominio jj.pink =
jj.pink</b></a> non =C3=A8 stato recapitato perch=C3=A9 il dominio jj.pink =
risulta inesistente. Verifica di non aver inserito errori di battitura o sp= risulta inesistente. Verifica di non aver inserito errori di battitura o sp=
azi superflui e riprova. azi superflui e riprova.
</td></tr> </td></tr>
@ -159,11 +161,47 @@ Content-Disposition: attachment; filename="icon.png"
Content-Transfer-Encoding: base64 Content-Transfer-Encoding: base64
Content-ID: <icon.png> Content-ID: <icon.png>
iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAABYlAAAWJQFJUiTwAAAA
GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABTdJREFUeNrsnD9sFEcUh5+PRMqZ
yA0SPhAUQAQFUkyTgiBASARo6QApqVIkfdxGFJFSgGhJAUIiBaQB0ZIOKVCkwUgURjIg2fxL4kS+
YDvkbC/388bi8N16Z4/d7J/5PsniuD3fyePP772ZeTsDQRAYQL/UGAJAIEAgQCBAIAAEAgQCBAIE
AkAgyJT3Mv+Eq7vYK8mTE+MDRCAghQECAeRQA5V2ZOpmg5vDx3NPzRbmGRMEcmTrEbNNB8zWfRD+
f/Efs2e3zCZvMjaksBg27TfbcuSNPEKP9ZyuAQKtHX2O9ncNgWC57umMPKvRNb0GEKgnLoUyxTQC
rcns0/6uIRAs8/hGf9cQCJZpTpjdO2f25/03z+mxntM1eLtsZAgiUtX4JcaBCAQIBAgECARQ8CJa
G5jab4J4pm4WZmO3OALVh802fIwcLkyPkcKAGggAgQCBAIEAgQCBABAIEAjKA/1AnahhbO5FdOOY
VsrrDbPBYcYKgf5D2wLaV3p+22xh1u17tO3S+DTcvxvagUDeivPgx/a/95J/73w7Sj26Hn4pKo2M
ehuV/KyBJM6d0f7k6RKx/R63vvL2tmf/ItDdM2ZTP6f7nkp9Y2fDx1v9akmpIU+KSCLVUghUQfSL
zVKeTklbLxGoctw/nzC5rw8L5KRNbkpnKq6pgSqEClzNnFzY+XnYWrt6VpVk1vbwWvg+RKCKMOUw
Q1LEOXA+/MX3mpJvGDHb265xtnzmFoUK1HaKQGlMtePYM+q2KKjXuaS1NJYIEKgI8jhEgqHt4cqy
Ky53j3hyHz2bqSLp2o2LbJ7MxKovkGqXteoWpaOk96O9/yF/dF7NwlS36AuIQIBA5celQK4PIxBE
4LLzrtoLgaALdSy6CJRkWQCBPGLsTHznomZ9nszUECgJ2ml3WWHe+QVFNPSQx6UdZNtxr9pbEShN
eTTz8mQXHoHSlke7+Z+c9m6VGoHSkEfs/trLW3wQKApN1V3lGfnGu2Z6BFoLtYCs3GWBPAiUCLVh
/HoaeRCoT9R873KLM/IgUBfapnCpe5AHgXry4pf412ihEHkQqCdxd5VqrcezhUIESsJMTJ+Pdthp
Z0WgyNlXXPHc2Mc4IVAELl2Gnh8mhUDvCkfbIVAkcbf/aOoO3fMKhqAD3frTa4quwpn0hUDOkQhI
YYBAgECAQAAU0QlYObl+5Ug8NcprZkZxjUCxRPVA6zmtEXHCBykskrhjgHXN09PoEcgFl4M4H11j
nBAoApcj6ZoPGScEAgTKApcDoTw5sgWB+sGlz1n90IBAPdE6j1o21PfcC11jLagL1oFWRyGlKU3p
OxcSJQ7NZAjkhHp/uG2HFAYIBAgECASAQIBAgECAQAAIBOkxEARBtp9wdVfAMOfIifEBIhCQwgCB
ABAI0oV2jhxZ+nfBatuPZfgBCy0Eqqo8c01b+uu51XZvzOgDWoHNTGR+pCwpLEd5svuAZXlO2uEr
PyEQ8hRWHgRCHmqg0sjTnLalv6crJQ8C/U8stqNO0I4+VZOHFIY8COS1PGL2ybd5yUMKK7s8zYmL
dujyd3n+nESgcsvzZd4/KwIhDwIhT35QA6UyE1qyxZnfvJMHgdKS549JC1qvvJOHFIY8CFR5eV5O
XimqPAhUdHnmfx+zgxdOFXkoqIGKKs/cswnb/8Oeog8HEai48nxUhiFBIORBIOShBioskkbySCLk
IQIhDwIhj28p7FApR6b1qlEbHGpkO/rr6215vi/zH1r2x7tApSGFAQIBAgECAQIBIBAgECAQIBBA
LK8FGADCTxYrr+EVJgAAAABJRU5ErkJggg==
--089e082ce1a07950b2056748acb0-- --089e082ce1a07950b2056748acb0--
--089e082ce1a07949ad056748acaf --089e082ce1a07949ad056748acaf
Content-Type: message/delivery-status Content-Type: message/delivery-status
Reporting-MTA: dns; googlemail.com
Received-From-MTA: dns; support@agilebg.com
Arrival-Date: Tue, 13 Mar 2018 03:25:11 -0700 (PDT)
X-Original-Message-ID: <1520936710.340821981430054.404664939598865-openerp-7-res.partner@elbati-Vostro-3550>
Final-Recipient: rfc822; jj@jj.pink
Action: failed
Status: 4.0.0
Diagnostic-Code: smtp; DNS Error: 21006586 DNS type 'mx' lookup of jj.pink responded with code NXDOMAIN
Domain name not found: jj.pink
Last-Attempt-Date: Tue, 13 Mar 2018 03:25:12 -0700 (PDT)
--089e082ce1a07949ad056748acaf --089e082ce1a07949ad056748acaf
Content-Type: message/rfc822 Content-Type: message/rfc822
@ -189,7 +227,8 @@ X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
i6XTqVWrZjPxSGhF3QtKqX3emLuxdp2HGwXEgFHqK2Ckti2zwkqvnZRyclXhsjz3BCW3 i6XTqVWrZjPxSGhF3QtKqX3emLuxdp2HGwXEgFHqK2Ckti2zwkqvnZRyclXhsjz3BCW3
B6cfziTjxnfRzClZozTOO30u+FkF7NWHeZ6SX7mkRC3iymnayRif4qs0yASNmFdWSo+Q B6cfziTjxnfRzClZozTOO30u+FkF7NWHeZ6SX7mkRC3iymnayRif4qs0yASNmFdWSo+Q
DPiA== DPiA==
X-Gm-Message-State: AElRT7HcU/pKvDTBS+u1vpLED5d18RpMEMxDuQNGJQTybNHBL+tOFsPm r4kpiCsS45ObtQFm602vRGNTpfrY
X-Gm-Message-State: AElRT7HcU/pKvDTBS+u1vpLED5d18RpMEMxDuQNGJQTybNHBL+tOFsPm
r4kpiCsS45ObtQFm602vRGNTpfrY
X-Google-Smtp-Source: AG47ELuqwAATDTpeGPm3Bkd+l3Xvi+nW1YzPRybnU3Co5geAM45/LlwjsooGXjg1mt8dvHtnVDi+bA== X-Google-Smtp-Source: AG47ELuqwAATDTpeGPm3Bkd+l3Xvi+nW1YzPRybnU3Co5geAM45/LlwjsooGXjg1mt8dvHtnVDi+bA==
X-Received: by 10.28.106.19 with SMTP id f19mr289835wmc.84.1520936712169; X-Received: by 10.28.106.19 with SMTP id f19mr289835wmc.84.1520936712169;
Tue, 13 Mar 2018 03:25:12 -0700 (PDT) Tue, 13 Mar 2018 03:25:12 -0700 (PDT)
@ -212,7 +251,8 @@ X-Odoo-db-uuid: b155a0e0-2612-11e8-b332-08edb9323673
X-Odoo-Objects: res.partner-7 X-Odoo-Objects: res.partner-7
--===============8882118813701652090== --===============8882118813701652090==
Content-Type: multipart/alternative; boundary="===============5618999107486207453=="
Content-Type: multipart/alternative;
boundary="===============5618999107486207453=="
MIME-Version: 1.0 MIME-Version: 1.0
--===============5618999107486207453== --===============5618999107486207453==
@ -223,6 +263,7 @@ Content-Transfer-Encoding: base64
dGVzdAotLQpBZG1pbmlzdHJhdG9yCgpTZW50IGJ5Ck15IENvbXBhbnkKWzFdCnVzaW5nCk9kb28g dGVzdAotLQpBZG1pbmlzdHJhdG9yCgpTZW50IGJ5Ck15IENvbXBhbnkKWzFdCnVzaW5nCk9kb28g
WzJdIC4KCgoKWzFdIGh0dHA6Ly93d3cueW91cmNvbXBhbnkuY29tClsyXSBodHRwczovL3d3dy5v WzJdIC4KCgoKWzFdIGh0dHA6Ly93d3cueW91cmNvbXBhbnkuY29tClsyXSBodHRwczovL3d3dy5v
ZG9vLmNvbQo= ZG9vLmNvbQo=
--===============5618999107486207453== --===============5618999107486207453==
Content-Type: text/html; charset="utf-8" Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0 MIME-Version: 1.0
@ -237,7 +278,9 @@ bm9uZTsgY29sb3I6ICM4NzVBN0I7IiBkYXRhLW8tbWFpbC1xdW90ZT0iMSI+CiAgICBNeSBDb21w
YW55CiAgICA8L2E+CiAgICB1c2luZwogICAgPGEgaHJlZj0iaHR0cHM6Ly93d3cub2Rvby5jb20i YW55CiAgICA8L2E+CiAgICB1c2luZwogICAgPGEgaHJlZj0iaHR0cHM6Ly93d3cub2Rvby5jb20i
IHN0eWxlPSJ0ZXh0LWRlY29yYXRpb246bm9uZTsgY29sb3I6ICM4NzVBN0I7IiBkYXRhLW8tbWFp IHN0eWxlPSJ0ZXh0LWRlY29yYXRpb246bm9uZTsgY29sb3I6ICM4NzVBN0I7IiBkYXRhLW8tbWFp
bC1xdW90ZT0iMSI+T2RvbzwvYT4uCjwvcD4KPC9kaXY+ bC1xdW90ZT0iMSI+T2RvbzwvYT4uCjwvcD4KPC9kaXY+
--===============5618999107486207453==-- --===============5618999107486207453==--
--===============8882118813701652090==-- --===============8882118813701652090==--
--089e082ce1a07949ad056748acaf-- --089e082ce1a07949ad056748acaf--

148
mail_notify_bounce/tests/data/bounce_message_2

@ -0,0 +1,148 @@
Delivered-To: catchall+100387-res.partner-3342@openerp.agilebg.com
Received: by 10.200.3.172 with SMTP id t44csp807834qtg;
Thu, 22 Mar 2018 03:11:49 -0700 (PDT)
X-Google-Smtp-Source: AG47ELvCw5X3EofeGH5PhUr8flDnN3FjSUkvHnEdaKHpvJVKgCs5hEuJvhFZmpDn6ZeBjXWM1qBr
X-Received: by 10.223.197.139 with SMTP id m11mr18456177wrg.198.1521713508964;
Thu, 22 Mar 2018 03:11:48 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1521713508; cv=none;
d=google.com; s=arc-20160816;
b=yapDUUZ2lifefaxNgZAEs7dOwQsRJ3mIWnDrSlrW/04+TVMa+0/p0WvNmoUvyzUNSQ
9Gr6cHTVAxPJejefKByWsfRSnYdpvKvKopY+PL8FN1aWN9ui0MXYIuuZ9wx7+WUh9uxm
ZuBgYAktwC/PKOFL8EnUip4qYyz3v+kTXwu3gFkY6UpZ0kj0J6xKx/CiDTJ69Rc3hPuy
WuK7tzRRCOo+IZz7mJi5sp0QLjLzVrBQJJ/xW6GWzAWNRS3tPUAeAjQUW7uIoD7SF8pP
pqkVExBiytM7PNbMh/ZmJQB2xp+XNuwDhBti8k6Uiv3kXqCv4xh4kVxgSoYeAqqGqcLp
cc3g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=message-id:mime-version:auto-submitted:to:subject:from:date
:arc-authentication-results;
bh=F08kgOAV9x4rcK6QrCWzhz0hfFl1ODcxJ5XznoAf1+M=;
b=mfLuUkUIhRuabYbk/3d3EkmNR+wjpxjA7gcl8tRdh5nZ7uhQsveCJbSK8+tF1AAtKE
kGOAfr0YXIZ9RFWNIKYbjT8iuuIx+xigRzPyrReYKDIkjXBAQ+9qiwqV6VB5Gz55d8ge
rK5sIcgvRYXBNbHKAuMQYzusRkt5qxADIMeN3DA0WVXRnypB0csFvLsh6Z23y5mNQkq+
jFZz7XhEId08XtvcZwUHMhXk4hFxLwV5N+BbMwKYsTBuwztYZS9DuJRbZIygvv+Evw7k
I7JUZqeU5hAzR86PFJHGWanx7dypnYO83/dgCKMzOe7k+J3yecMMlifPC+/IQ5uvO4fP
aBAQ==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: best guess record for domain of postmaster@odoo10.agilebg.com designates 212.35.199.210 as permitted sender) smtp.helo=odoo10.agilebg.com
Return-Path: <>
Received: from odoo10.agilebg.com (openerp.agilebg.com. [212.35.199.210])
by mx.google.com with ESMTPS id r94si5018388wrb.399.2018.03.22.03.11.48
for <catchall+100387-res.partner-3342@openerp.agilebg.com>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 22 Mar 2018 03:11:48 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of postmaster@odoo10.agilebg.com designates 212.35.199.210 as permitted sender) client-ip=212.35.199.210;
Authentication-Results: mx.google.com;
spf=pass (google.com: best guess record for domain of postmaster@odoo10.agilebg.com designates 212.35.199.210 as permitted sender) smtp.helo=odoo10.agilebg.com
Received: by odoo10.agilebg.com (Postfix)
id 8525410043F; Thu, 22 Mar 2018 11:11:48 +0100 (CET)
Date: Thu, 22 Mar 2018 11:11:48 +0100 (CET)
From: MAILER-DAEMON@odoo10.agilebg.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: catchall+100387-res.partner-3342@openerp.agilebg.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="5E4E910043D.1521713508/odoo10.agilebg.com"
Message-Id: <20180322101148.8525410043F@odoo10.agilebg.com>
This is a MIME-encapsulated message.
--5E4E910043D.1521713508/odoo10.agilebg.com
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii
This is the mail system at host odoo10.agilebg.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<jj@jj.pink>: Host or domain name not found. Name service error for
name=jj.pink type=AAAA: Host not found
--5E4E910043D.1521713508/odoo10.agilebg.com
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; odoo10.agilebg.com
X-Postfix-Queue-ID: 5E4E910043D
X-Postfix-Sender: rfc822; catchall+100387-res.partner-3342@openerp.agilebg.com
Arrival-Date: Thu, 22 Mar 2018 11:11:48 +0100 (CET)
Final-Recipient: rfc822; jj@jj.pink
Original-Recipient: rfc822;jj@jj.pink
Action: failed
Status: 5.4.4
Diagnostic-Code: X-Postfix; Host or domain name not found. Name service error
for name=jj.pink type=AAAA: Host not found
--5E4E910043D.1521713508/odoo10.agilebg.com
Content-Description: Undelivered Message
Content-Type: message/rfc822
Return-Path: <catchall+100387-res.partner-3342@openerp.agilebg.com>
Received: from openerp.agilebg.com (localhost [IPv6:::1])
by odoo10.agilebg.com (Postfix) with ESMTPS id 5E4E910043D;
Thu, 22 Mar 2018 11:11:48 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=openerp.agilebg.com;
s=mail; t=1521713508;
bh=XM6oNst+a4NL3PGJ1aWi4QJEEpPylU7exovp16MS4gA=;
h=Subject:From:Reply-To:To:Date:From;
b=RHxpioE4IlCIHExtaRps5z/fiFvvJdIn/GxWdDtzqaVFUtvnBsnqqGEZ5E0s3Fyi7
tkQFZP3MF9Zlzub9gwblsDFIScsuKwlPXIK+Xp9IBx9RJdXSCvKnUkAxjbve5vNkLc
yQNUC5wruQkKIVC5mb32kp0BzFg8KKZpVRsf4JzU=
Content-Type: multipart/mixed; boundary="===============5291852991323074884=="
MIME-Version: 1.0
Message-Id: <1521713445.211167097091675.905862349786927-openerp-3342-res.partner@odoo10.agilebg.com>
Subject: Re: jj@jj.pink
From: Lorenzo Battistini <catchall@openerp.agilebg.com>
Reply-To: Agile Business Group Sagl <catchall@openerp.agilebg.com>
To: "jj@jj.pink" <jj@jj.pink>
Date: Thu, 22 Mar 2018 10:11:48 -0000
X-Odoo-Tracking-ID: 227376
X-Odoo-db-uuid: 265d92e8-8b23-11e2-afb4-525400cb0a64
X-Odoo-Database: (u'agilebg',)
X-Odoo-Objects: res.partner-3342
Sender: Lorenzo Battistini <lorenzo.battistini@agilebg.com>
--===============5291852991323074884==
Content-Type: multipart/alternative;
boundary="===============7339659580950519963=="
MIME-Version: 1.0
--===============7339659580950519963==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
dGVzdApMb3JlbnpvIEJhdHRpc3RpbmkKCgpTZW50IGJ5CkFnaWxlIEJ1c2luZXNzIEdyb3VwIFNh
Z2wKWzFdCnVzaW5nCk9kb28gWzJdIC4KCkFsc28gbm90aWZpZWQ6IGpqQGpqLnBpbmsuCgoKWzFd
IGh0dHA6Ly93d3cuYWdpbGViZy5jb20KWzJdIGh0dHBzOi8vd3d3Lm9kb28uY29tCg==
--===============7339659580950519963==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
PGJhc2UgaHJlZj0naHR0cHM6Ly93d3cuYWdpbGViZy5jb20nPgo8cD50ZXN0PC9wPgogICAgPHA+
TG9yZW56byBCYXR0aXN0aW5pPC9wPgo8YnI+CjxwIHN0eWxlPSJjb2xvcjogIzU1NTU1NTsiPgog
ICAgU2VudCBieQogICAgPGEgaHJlZj0iaHR0cDovL3d3dy5hZ2lsZWJnLmNvbSIgc3R5bGU9InRl
eHQtZGVjb3JhdGlvbjpub25lOyBjb2xvcjogIzg3NUE3QjsiPgogICAgQWdpbGUgQnVzaW5lc3Mg
R3JvdXAgU2FnbAogICAgPC9hPgogICAgdXNpbmcKICAgIDxhIGhyZWY9Imh0dHBzOi8vd3d3Lm9k
b28uY29tIiBzdHlsZT0idGV4dC1kZWNvcmF0aW9uOm5vbmU7IGNvbG9yOiAjODc1QTdCOyI+T2Rv
bzwvYT4uCjwvcD4KPGJyPjxzbWFsbD5BbHNvIG5vdGlmaWVkOiBqakBqai5waW5rLjwvc21hbGw+
PGJyPgoKPGltZyBzcmM9Imh0dHBzOi8vd3d3LmFnaWxlYmcuY29tL21haWwvdHJhY2tpbmcvb3Bl
bi9hZ2lsZWJnLzIyNzM3Ni9ibGFuay5naWYiIGFsdD0iIiBkYXRhLW9kb28tdHJhY2tpbmctZW1h
aWw9IjIyNzM3NiIvPgo=
--===============7339659580950519963==--
--===============5291852991323074884==--
--5E4E910043D.1521713508/odoo10.agilebg.com--

16
mail_notify_bounce/tests/test_mail_notify_bounce.py

@ -23,6 +23,7 @@ class TestMailNotification(common.TransactionCase):
'password': 'disabled', 'password': 'disabled',
'bounce_notify_partner_ids': [(6, 0, [admin_id])] 'bounce_notify_partner_ids': [(6, 0, [admin_id])]
}) })
path = get_module_resource( path = get_module_resource(
'mail_notify_bounce', 'mail_notify_bounce',
'tests', 'data', 'bounce_message' 'tests', 'data', 'bounce_message'
@ -37,3 +38,18 @@ class TestMailNotification(common.TransactionCase):
self.assertEqual(sent_mail.recipient_ids.name, 'Administrator') self.assertEqual(sent_mail.recipient_ids.name, 'Administrator')
self.assertEqual( self.assertEqual(
sent_mail.subject, 'Delivery Status Notification (Failure)') sent_mail.subject, 'Delivery Status Notification (Failure)')
path = get_module_resource(
'mail_notify_bounce',
'tests', 'data', 'bounce_message_2'
)
with open(path) as bounce_message:
self.thread_model.with_context(
fetchmail_server_id=server.id
).message_process(
model='res.partner', message=bounce_message.read())
sent_mail = self.env['mail.mail'].search(
[], order="create_date desc")[0]
self.assertEqual(sent_mail.recipient_ids.name, 'Administrator')
self.assertEqual(
sent_mail.subject, 'Delivery Status Notification (Failure)')
Loading…
Cancel
Save