Commit 7ecd1a3b authored by Jérome Perrin's avatar Jérome Perrin

Due to daylight saving, GMT DateTime('2007/10/24') + 5 !=...

Due to daylight saving, GMT DateTime('2007/10/24') + 5 != DateTime('2007/10/29') because both dates are not in the same timezone, so compare .Date() instead of exact date


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17164 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7b02f039
...@@ -1393,20 +1393,23 @@ class TestNextNegativeInventoryDate(InventoryAPITestCase): ...@@ -1393,20 +1393,23 @@ class TestNextNegativeInventoryDate(InventoryAPITestCase):
start_date=start_date, start_date=start_date,
simulation_state='planned') simulation_state='planned')
node_uid = self.node.getUid() node_uid = self.node.getUid()
date = DateTime(DateTime().strftime('%Y/%m/%d')) date = DateTime()
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None)
makeMovement(quantity=1, change_way=1, start_date=date) makeMovement(quantity=1, change_way=1, start_date=date)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None)
makeMovement(quantity=3, change_way=0, start_date=date+2) makeMovement(quantity=3, change_way=0, start_date=date+2)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+2) self.assertEquals((date + 2).Date(),
getNextNegativeInventoryDate(node_uid=node_uid).Date())
makeMovement(quantity=5, change_way=1, start_date=date+1) makeMovement(quantity=5, change_way=1, start_date=date+1)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None)
makeMovement(quantity=7, change_way=0, start_date=date+5) makeMovement(quantity=7, change_way=0, start_date=date+5)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+5) self.assertEquals((date + 5).Date(),
getNextNegativeInventoryDate(node_uid=node_uid).Date())
makeMovement(quantity=7, change_way=1, start_date=date+4) makeMovement(quantity=7, change_way=1, start_date=date+4)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None) self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), None)
makeMovement(quantity=7, change_way=0, start_date=date+3) makeMovement(quantity=7, change_way=0, start_date=date+3)
self.assertEquals(getNextNegativeInventoryDate(node_uid=node_uid), date+3) self.assertEquals((date + 3).Date(),
getNextNegativeInventoryDate(node_uid=node_uid).Date())
class TestInventoryStat(InventoryAPITestCase): class TestInventoryStat(InventoryAPITestCase):
"""Tests Inventory Stat methods. """Tests Inventory Stat methods.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment