Skip to content
Permalink
Browse files

Test clean

  • Loading branch information...
kebeclibre committed Nov 8, 2019
1 parent 3e4623a commit 10a07a44dfd0e0bc598130cc2c3e4d1738383d71
Showing with 12 additions and 1 deletion.
  1. +12 −1 addons/bus/tests/test_assetsbundle.py
@@ -3,21 +3,32 @@
from unittest.mock import patch

import odoo.tests
from odoo.osv import expression


@odoo.tests.tagged('post_install', '-at_install')
class BusWebTests(odoo.tests.HttpCase):

def test_bundle_sends_bus(self):
db_name = self.env.registry.db_name
bundle_xml_ids = ('web.assets_common', 'web.assets_backend')

attach_domain = []
for bundle in bundle_xml_ids:
domain = expression.OR([
domain,
[('name', 'ilike', bundle + '%')]
])
# start from a clean slate
self.env['ir.attachment'].search(domain).unlink()

send_one_counter = 0
def _patched_sendone(channel, message):
nonlocal send_one_counter
send_one_counter += 1
self.assertEqual(channel, (db_name, 'bundle_changed'))
self.assertEqual(len(message), 2)
self.assertTrue(message[0] in ('web.assets_common', 'web.assets_backend'))
self.assertTrue(message[0] in bundle_xml_ids)
self.assertTrue(isinstance(message[1], str))

with patch('odoo.addons.bus.models.bus.ImBus.sendone', wraps=_patched_sendone, create=True):

0 comments on commit 10a07a4

Please sign in to comment.
You can’t perform that action at this time.