[FIX] mail_tracking: Show correctly blank image

Bad P2 > P3 conversion
pull/432/head
Pedro M. Baeza 2019-07-24 12:39:27 +02:00
parent 29a19f41db
commit 42b246056a
3 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@
{
"name": "Email tracking",
"summary": "Email tracking system for all mails sent",
"version": "12.0.1.1.2",
"version": "12.0.1.1.3",
"category": "Social Network",
"website": "http://github.com/OCA/social",
"author": "Tecnativa, "

View File

@ -5,9 +5,10 @@ import werkzeug
from psycopg2 import OperationalError
from odoo import api, http, registry, SUPERUSER_ID
import logging
import base64
_logger = logging.getLogger(__name__)
BLANK = b'R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
BLANK = 'R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='
def _env_get(db, callback, tracking_id, event_type, **kw):
@ -82,5 +83,5 @@ class MailTrackingController(http.Controller):
# Always return GIF blank image
response = werkzeug.wrappers.Response()
response.mimetype = 'image/gif'
response.data = BLANK
response.data = base64.b64decode(BLANK)
return response

View File

@ -4,6 +4,7 @@
import mock
from odoo.tools import mute_logger
import time
import base64
from odoo import http
from odoo.tests.common import TransactionCase
from ..controllers.main import MailTrackingController, BLANK
@ -175,7 +176,7 @@ class TestMailTracking(TransactionCase):
def test_mail_send(self):
controller = MailTrackingController()
db = self.env.cr.dbname
image = BLANK
image = base64.b64decode(BLANK)
mail, tracking = self.mail_send(self.recipient.email)
self.assertEqual(mail.email_to, tracking.recipient)
self.assertEqual(mail.email_from, tracking.sender)