[Erp5-report] r17427 - /erp5/trunk/products/ERP5/tests/testInvoice.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 6 18:11:34 CET 2007
Author: alex
Date: Tue Nov 6 18:11:34 2007
New Revision: 17427
URL: http://svn.erp5.org?rev=17427&view=rev
Log:
test that we don't have a rule more than once at a given node of the simulation tree
Modified:
erp5/trunk/products/ERP5/tests/testInvoice.py
Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=17427&r1=17426&r2=17427&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py Tue Nov 6 18:11:34 2007
@@ -84,7 +84,7 @@
def login(self, quiet=0, run=1):
uf = self.getPortal().acl_users
- uf._doAddUser('alex', 'alex', ['Manager', 'Assignee', 'Assignor',
+ uf._doAddUser('alex', '', ['Manager', 'Assignee', 'Assignor',
'Associate', 'Auditor', 'Author'], [])
user = uf.getUserById('alex').__of__(uf)
newSecurityManager(None, user)
@@ -954,9 +954,9 @@
activity_tool = self.getActivityTool()
activity_tool.manageClearActivities(keep=0)
else:
- self.fail("""Error: stepConfirmInvoice didn't fail, the builder script
- InvoiceTransaction_postTransactionLineGeneration should have
- complain that accounting movements use multiple resources""")
+ self.fail("Error: stepConfirmInvoice didn't fail, the builder script"
+ + " InvoiceTransaction_postTransactionLineGeneration should have"
+ + " complained that accounting movements use multiple resources")
def stepCheckSimulationTrees(self, sequence=None, sequence_list=[]):
"""
@@ -1010,11 +1010,18 @@
movement.getPath()))
elif k == 'next_rule_list':
for movement in rule.objectValues():
+ found_rule_dict = {}
for next_rule in movement.objectValues():
- self.assertTrue(next_rule.getSpecialiseValue().getPortalType()
- in v, 'looking for %s in %s on %s' % (
- next_rule.getSpecialiseValue().getPortalType(), v,
- next_rule.getPath()))
+ next_rule_type = next_rule.getSpecialiseValue().getPortalType()
+ self.assertTrue(next_rule_type in v,
+ 'looking for %s in %s on %s' % (
+ next_rule_type, v, next_rule.getPath()))
+ n = found_rule_dict.get(next_rule_type, 0)
+ found_rule_dict[next_rule_type] = n + 1
+ # for each movement, we want to make sure that each rule is not
+ # instanciated more than once
+ if len(found_rule_dict):
+ self.assertEquals(set(found_rule_dict.itervalues()), set([1]))
elif k == 'parent_movement_type_list':
if rule.getParentValue().getDeliveryValue() is not None:
parent_type = rule.getParentValue().getDeliveryValue().getPortalType()
More information about the Erp5-report
mailing list