Commit b8c57b8e authored by Jérome Perrin's avatar Jérome Perrin

Mark expected failures using expectedFailure decorator.

There has been a minor regression in r36023, passing the same group twice to
section_category (or other *_category such as node_category) was working in
getMovementHistoryList, eventhough it was not working in getInventoryList, for
now this is an expected failure, but it could be turned into a TypeError raised
by inventory API



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36050 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3951be82
...@@ -43,6 +43,7 @@ from Testing import ZopeTestCase ...@@ -43,6 +43,7 @@ from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex from Products.ERP5Type.tests.utils import reindex
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
...@@ -565,8 +566,8 @@ class TestInventory(InventoryAPITestCase): ...@@ -565,8 +566,8 @@ class TestInventory(InventoryAPITestCase):
self.getInventoryEquals(total_quantity, self.getInventoryEquals(total_quantity,
node_category=category.getRelativeUrl()) node_category=category.getRelativeUrl())
# FIXME: this test is currently broken @expectedFailure
def TODO_test_DoubleSectionCategory(self): def test_DoubleCategoryMembershipSectionCategory(self):
"""Tests inventory on section category, when the section is twice member\ """Tests inventory on section category, when the section is twice member\
of the same category like it happens for group and mapping""" of the same category like it happens for group and mapping"""
self.section.setGroup('level1/level2') self.section.setGroup('level1/level2')
...@@ -1115,7 +1116,7 @@ class TestMovementHistoryList(InventoryAPITestCase): ...@@ -1115,7 +1116,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
'group/level1/level2', 'group/level1/level2',
['group/level1', 'group/anotherlevel'], ['group/level1', 'group/anotherlevel'],
['group/level1', 'group/level1'], ['group/level1', 'group/level1'],
['group/level1', 'group/level1/level2'], ]: ]:
movement_history_list = getMovementHistoryList( movement_history_list = getMovementHistoryList(
section_category=section_category) section_category=section_category)
self.assertEquals(len(movement_history_list), 1) self.assertEquals(len(movement_history_list), 1)
...@@ -1130,6 +1131,19 @@ class TestMovementHistoryList(InventoryAPITestCase): ...@@ -1130,6 +1131,19 @@ class TestMovementHistoryList(InventoryAPITestCase):
section_category='group/level1', section_category='group/level1',
ignored='argument')), 1) ignored='argument')), 1)
@expectedFailure
def testDoubleSectionCategory(self):
# it is currently invalid to pass the same category twice to inventory API
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
self.section.setGroup('level1/level2')
mvt = self._makeMovement(quantity=100)
movement_history_list = getMovementHistoryList(
section_category=['group/level1',
'group/level1/level2'])
self.assertEquals(len(movement_history_list), 1)
self.assertEquals(movement_history_list[0].total_quantity, 100)
def testNodeCategoryAndSectionCategory(self): def testNodeCategoryAndSectionCategory(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
self.section.setGroup('level1/level2') self.section.setGroup('level1/level2')
...@@ -1138,8 +1152,7 @@ class TestMovementHistoryList(InventoryAPITestCase): ...@@ -1138,8 +1152,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
valid_category_list = [ 'group/level1', valid_category_list = [ 'group/level1',
['group/level1', 'group/anotherlevel'], ['group/level1', 'group/anotherlevel'],
['group/level1', 'group/level1'], ['group/level1', 'group/level1'], ]
['group/level1', 'group/level1/level2'], ]
invalid_category_list = ['group/anotherlevel', 'product_line/level1'] invalid_category_list = ['group/anotherlevel', 'product_line/level1']
# both valid # both valid
......
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