Commit 4aec77f3 authored by Jérome Perrin's avatar Jérome Perrin

Run invoice tests with Assignee & Author roles only.

Remove unused methods.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7292 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef905241
...@@ -79,12 +79,17 @@ class TestInvoice(TestPackingListMixin, ...@@ -79,12 +79,17 @@ class TestInvoice(TestPackingListMixin,
def login(self, quiet=0, run=1): def login(self, quiet=0, run=1):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
# FIXME: unittest user should not have the Manager role
uf._doAddUser('alex', '', ['Manager', 'Assignee', 'Assignor', uf._doAddUser('alex', '', ['Manager', 'Assignee', 'Assignor',
'Associate', 'Auditor', 'Author'], []) 'Associate', 'Auditor', 'Author'], [])
user = uf.getUserById('alex').__of__(uf) user = uf.getUserById('alex').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def stepLoginAsAssignee(self, sequence=None, **kw):
uf = self.getPortal().acl_users
uf._doAddUser('assignee', '', ['Assignee', 'Author' ], [])
user = uf.getUserById('assignee').__of__(uf)
newSecurityManager(None, user)
def createCategories(self): def createCategories(self):
"""Create the categories for our test. """ """Create the categories for our test. """
TestPackingListMixin.createCategories(self) TestPackingListMixin.createCategories(self)
...@@ -318,7 +323,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -318,7 +323,7 @@ class TestInvoice(TestPackingListMixin,
startswith(invoice_relative_url)) startswith(invoice_relative_url))
# Then, test if each Invoice movement is equals to the sum of somes # Then, test if each Invoice movement is equals to the sum of somes
# Simulation Movemen # Simulation Movements
for invoice_movement in invoice.getMovementList(portal_type = [ for invoice_movement in invoice.getMovementList(portal_type = [
self.sale_invoice_cell_portal_type, self.sale_invoice_cell_portal_type,
self.sale_invoice_line_portal_type]) : self.sale_invoice_line_portal_type]) :
...@@ -390,6 +395,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -390,6 +395,7 @@ class TestInvoice(TestPackingListMixin,
order_line.setResourceValue(product) order_line.setResourceValue(product)
order_line.setQuantity(10) order_line.setQuantity(10)
order_line.setPrice(100) order_line.setPrice(100)
self.assertEquals(len(order.checkConsistency()), 0)
sequence.edit( sequence.edit(
order = order, order = order,
order_line = order_line, order_line = order_line,
...@@ -397,6 +403,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -397,6 +403,7 @@ class TestInvoice(TestPackingListMixin,
self.assertEquals(order_line.getTotalPrice(), 10*100) self.assertEquals(order_line.getTotalPrice(), 10*100)
def stepCheckOrderRule(self, sequence=None, sequence_list=None, **kw): def stepCheckOrderRule(self, sequence=None, sequence_list=None, **kw):
"""Check we have a related Order Rule"""
order = sequence.get('order') order = sequence.get('order')
simulation_tool = self.getSimulationTool() simulation_tool = self.getSimulationTool()
# Check that there is an applied rule for our packing list # Check that there is an applied rule for our packing list
...@@ -404,25 +411,9 @@ class TestInvoice(TestPackingListMixin, ...@@ -404,25 +411,9 @@ class TestInvoice(TestPackingListMixin,
if x.getCausalityValue()==order] if x.getCausalityValue()==order]
self.assertNotEquals(len(rule_list), 0) self.assertNotEquals(len(rule_list), 0)
sequence.edit(order_rule_list = rule_list) sequence.edit(order_rule_list = rule_list)
# TODO
return self.assertEquals(len(order.getMovementList()),
""" sum([len(rule.objectIds()) for rule in rule_list]))
rule_line_list = order_rule.objectValues()
order_line_list = order.objectValues()
self.assertEquals(len(order_line_list), len(rule_line_list))
self.assertEquals(1, len(rule_line_list))
rule_line = rule_line_list[0]
sequence.edit(order_rule_line=rule_line)
order_line = order_line_list[0]
self.assertEquals(rule_line.getQuantity(), 10)
self.assertEquals(rule_line.getPrice(), 100)
self.assertEquals(rule_line.getOrderValue(), order_line)
self.assertEquals(rule_line.getStartDate(), order_line.getStartDate())
self.assertEquals(rule_line.getStopDate(), order_line.getStopDate())
self.assertEquals(rule_line.getPortalType(), 'Simulation Movement')
self.assertEquals(rule_line.getResourceValue(),
order_line.getResourceValue())
"""
def stepCheckInvoicingRule(self, sequence=None, sequence_list=None, **kw): def stepCheckInvoicingRule(self, sequence=None, sequence_list=None, **kw):
""" Checks that the invoicing rule is applied and its values are """ Checks that the invoicing rule is applied and its values are
...@@ -458,6 +449,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -458,6 +449,7 @@ class TestInvoice(TestPackingListMixin,
self, sequence=None, sequence_list=None, **kw): self, sequence=None, sequence_list=None, **kw):
""" Checks that a delivery rule has been created when we took 'split """ Checks that a delivery rule has been created when we took 'split
and defer' decision on the divergeant Packing List. """ and defer' decision on the divergeant Packing List. """
# TODO
def stepCheckDeliveryRuleIsEmpty( def stepCheckDeliveryRuleIsEmpty(
self, sequence=None, sequence_list=None, **kw): self, sequence=None, sequence_list=None, **kw):
...@@ -518,28 +510,6 @@ class TestInvoice(TestPackingListMixin, ...@@ -518,28 +510,6 @@ class TestInvoice(TestPackingListMixin,
self.total_price1) self.total_price1)
sequence.edit(packing_list = sale_packing_list) sequence.edit(packing_list = sale_packing_list)
def stepCheckInvoice(self,sequence=None, sequence_list=None, **kw):
""" checks invoice properties are well set. """
# XXX need to clear the accounting module.
accounting_module = self.getAccountingModule()
sale_invoice_transaction_list = accounting_module.objectValues()
self.assertEquals(len(sale_invoice_transaction_list),1)
packing_list = sequence.get("packing_list")
sale_invoice = sale_invoice_transaction_list[0]
sequence.edit(invoice=sale_invoice)
sale_invoice_line_list = sale_invoice.contentValues(
filter={'portal_type':'Invoice Line'})
self.assertEquals(len(sale_invoice_line_list),1)
sale_invoice_line = sale_invoice_line_list[0]
sequence.edit(invoice_line=sale_invoice_line)
product = sequence.get('resource')
self.assertEquals(sale_invoice_line.getResourceValue(), product)
self.assertEquals(sale_invoice_line.getPrice(), self.price1)
self.assertEquals(sale_invoice_line.getQuantity(), self.quantity1)
self.assertEquals(sale_invoice_line.getTotalPrice(), self.total_price1)
self.assertEquals(sale_invoice.getCausalityValue(), packing_list)
def stepCheckTwoInvoices(self,sequence=None, sequence_list=None, **kw): def stepCheckTwoInvoices(self,sequence=None, sequence_list=None, **kw):
""" checks invoice properties are well set. """ """ checks invoice properties are well set. """
# New we will check that we have two invoices # New we will check that we have two invoices
...@@ -621,8 +591,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -621,8 +591,7 @@ class TestInvoice(TestPackingListMixin,
def stepModifyInvoicesDate(self, sequence=None, def stepModifyInvoicesDate(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
"""Rebuilds with sale_invoice_builder and checks nothing more is """Change invoice date"""
created. """
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
new_invoice = sequence.get('new_invoice') new_invoice = sequence.get('new_invoice')
invoice.edit(start_date=self.datetime, invoice.edit(start_date=self.datetime,
...@@ -691,6 +660,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -691,6 +660,7 @@ class TestInvoice(TestPackingListMixin,
# default sequence for one line of not varianted resource. # default sequence for one line of not varianted resource.
PACKING_LIST_DEFAULT_SEQUENCE = """ PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateSaleInvoiceTransactionRule stepCreateSaleInvoiceTransactionRule
stepLoginAsAssignee
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateOrder stepCreateOrder
...@@ -753,6 +723,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -753,6 +723,7 @@ class TestInvoice(TestPackingListMixin,
# default sequence for one line of not varianted resource. # default sequence for one line of not varianted resource.
TWO_PACKING_LIST_DEFAULT_SEQUENCE = """ TWO_PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateSaleInvoiceTransactionRule stepCreateSaleInvoiceTransactionRule
stepLoginAsAssignee
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateOrder stepCreateOrder
......
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