Skip to content

Commit

Permalink
Merge PR #694 into 13.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
shopinvader-git-bot committed Aug 29, 2020
2 parents bc75d81 + 8a0dc5a commit b9a80e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions shopinvader_search_engine/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import test_delete_product
from . import test_action_server
37 changes: 37 additions & 0 deletions shopinvader_search_engine/tests/test_action_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2020 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.queue_job.tests.common import JobMixin
from odoo.addons.shopinvader.tests.common import ProductCommonCase


class ActionServerCase(ProductCommonCase, JobMixin):
def test_action_server_on_product_template(self):
job = self.job_counter()
# we take the number of variant linked => the number of created jobs
bindings = self.env["shopinvader.product"].search([], limit=4)
variant_length = len(bindings.mapped("shopinvader_variant_ids"))
action = self.env.ref(
"shopinvader_search_engine.action_recompute_shopinvader_product"
)
action_context = action.with_context(
active_model="product.template",
active_ids=bindings.mapped("record_id").ids,
)
action_context.run()
self.assertEqual(job.count_created(), variant_length)

def test_action_server_on_product_category(self):
self.backend.bind_all_category()
job = self.job_counter()
bindings = self.env["shopinvader.category"].search([], limit=4)
action = self.env.ref(
"shopinvader_search_engine.action_recompute_shopinvader_category"
)
action_context = action.with_context(
active_model="product.category",
active_ids=bindings.mapped("record_id").ids,
)
action_context.run()
self.assertEqual(job.count_created(), 4)

0 comments on commit b9a80e5

Please sign in to comment.