Skip to content

Commit

Permalink
[IMP] Mute logging related to checkpoint notifications in tests
Browse files Browse the repository at this point in the history
```
2020-11-05 13:36:35,202 6822 INFO openerp_test odoo.tests: skip sending email in test mode
2020-11-05 13:36:35,206 6822 INFO openerp_test odoo.addons.mail.models.mail_mail: Mail with ID 1 and Message-Id '<342741149332557.1604583395.110157728195190-openerp-1-connector.checkpoint@travis-job-14c1db44-ca6c-40e2-82ff-03dcf3df66dc>' successfully sent
2020-11-05 13:36:35,227 6822 INFO openerp_test odoo.models.unlink: User OCA#1 deleted mail.mail records with IDs: [1]
2020-11-05 13:36:35,228 6822 INFO openerp_test odoo.addons.mail.models.mail_mail: Sent batch 1 emails via mail server ID #False
```
  • Loading branch information
StefanRijnhart authored and victoralmau committed Aug 25, 2021
1 parent 5931143 commit adb817c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion connector_magento/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{'name': 'Magento Connector',
'version': '12.0.1.1.0',
'version': '12.0.1.1.2',
'category': 'Connector',
'depends': ['account',
'base_technical_user',
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/connector_magento.pot
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ msgid "Already exported"
msgstr ""

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ msgid "Already exported"
msgstr ""

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ msgid "Already exported"
msgstr ""

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ msgid "Already exported"
msgstr "Déjà exporté"

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr "Déjà importé"
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ msgid "Already exported"
msgstr "Già esportato"

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr "Già importato"
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ msgid "Already exported"
msgstr ""

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ msgid "Already exported"
msgstr "Já exportado"

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr "Já importado"
Expand Down
2 changes: 1 addition & 1 deletion connector_magento/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ msgid "Already exported"
msgstr ""

#. module: connector_magento
#: code:addons/connector_magento/models/sale_order/importer.py:374
#: code:addons/connector_magento/models/sale_order/importer.py:389
#, python-format
msgid "Already imported"
msgstr ""
Expand Down
25 changes: 18 additions & 7 deletions connector_magento/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from contextlib import contextmanager
from odoo import models
from odoo.addons.component.tests.common import SavepointComponentCase
from odoo.tools import mute_logger

from vcr import VCR

Expand Down Expand Up @@ -160,11 +161,16 @@ def _import_record(self, model_name, magento_id, cassette=True):
filename = 'import_%s_%s' % (table_name[8:], str(magento_id))

def run_import():
if self.backend.version != '1.7':
return self.env[model_name].import_record(
self.backend, magento_id)
with mock_urlopen_image():
self.env[model_name].import_record(self.backend, magento_id)
with mute_logger(
'odoo.addons.mail.models.mail_mail',
'odoo.models.unlink',
'odoo.tests'):
if self.backend.version != '1.7':
return self.env[model_name].import_record(
self.backend, magento_id)
with mock_urlopen_image():
self.env[model_name].import_record(
self.backend, magento_id)

if cassette:
with self.recorder.use_cassette(filename):
Expand Down Expand Up @@ -271,5 +277,10 @@ class MagentoSyncTestCase(MagentoTestCase):

def setUp(self):
super(MagentoSyncTestCase, self).setUp()
with recorder.use_cassette('metadata'):
self.backend.synchronize_metadata()
# Mute logging of notifications about new checkpoints
with mute_logger(
'odoo.addons.mail.models.mail_mail',
'odoo.models.unlink',
'odoo.tests'):
with recorder.use_cassette('metadata'):
self.backend.synchronize_metadata()
9 changes: 7 additions & 2 deletions connector_magento/tests/magento2/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from os.path import dirname, join
from vcr import VCR

from odoo.tools import mute_logger
from ..common import MagentoTestCase


Expand All @@ -38,5 +39,9 @@ def setUp(self):
class Magento2SyncTestCase(Magento2TestCase):
def setUp(self):
super(Magento2SyncTestCase, self).setUp()
with recorder.use_cassette('metadata'):
self.backend.synchronize_metadata()
with mute_logger(
'odoo.addons.mail.models.mail_mail',
'odoo.models.unlink',
'odoo.tests'):
with recorder.use_cassette('metadata'):
self.backend.synchronize_metadata()

0 comments on commit adb817c

Please sign in to comment.