Skip to content

Commit

Permalink
fixup! more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SilvioC2C committed Apr 19, 2024
1 parent 9109f96 commit 320fb64
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
3 changes: 2 additions & 1 deletion stock_warehouse_calendar_orderpoint/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import test_calendar_orderpoint
from . import test_orderpoint_json_lead_days_popover
from . import test_orderpoint_lead_days_date
8 changes: 4 additions & 4 deletions stock_warehouse_calendar_orderpoint/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def setUpClass(cls):
"product_uom": cls.env.ref("uom.product_uom_unit"),
}
)
# We want only 1 reordering rule of type "pull" to avoid inconsistent behaviors
# To avoid strange behaviors:
# - set the first rule to be of type "pull"
# - set all rules' delays to 0 (the "pull" rule's delay is updated in tests)
cls.reordering_rule = cls.orderpoint.rule_ids[0]
cls.reordering_rule.action = "pull"
other_rules = cls.orderpoint.rule_ids - cls.reordering_rule
if other_rules:
other_rules.unlink()
cls.orderpoint.rule_ids.write({"delay": 0})
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2022 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)

from json import loads

from freezegun import freeze_time

from .common import CommonCalendarOrderpoint


class TestOrderpointJsonPopover(CommonCalendarOrderpoint):
"""Tests orderpoint's Json popover info"""

@freeze_time("2024-04-01 10:00")
def test_00_json_popover_info(self):
self.wh.orderpoint_calendar_id = self.reordering_calendar
self.wh.calendar_id = self.working_hours_calendar
self.reordering_rule.delay = 5
self.env["stock.warehouse.orderpoint"].invalidate_cache(
["json_lead_days_popover"]
)
info = loads(self.orderpoint.json_lead_days_popover)
self.assertIn("lead_days_description", info)
self.assertIn(
"<td>Reordering Date</td><td class='text-right'>04/03/2024</td>",
info["lead_days_description"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .common import CommonCalendarOrderpoint


class TestCalendarOrderpoint(CommonCalendarOrderpoint):
class TestOrderpointLeadDaysDate(CommonCalendarOrderpoint):
"""Tests orderpoints' forecast date computations
The OP calendar defines reordering slots as Wed 8-12 + 13-17, Sat 13-17.
Expand Down

0 comments on commit 320fb64

Please sign in to comment.