[Erp5-report] r11266 - /erp5/trunk/products/ERP5Banking/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Nov 13 10:23:26 CET 2006
Author: seb
Date: Mon Nov 13 10:23:25 2006
New Revision: 11266
URL: http://svn.erp5.org?rev=11266&view=rev
Log:
added mixin class on traveler check sale in order to test the traveler check purchase module
Modified:
erp5/trunk/products/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py
Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py?rev=11266&r1=11265&r2=11266&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingTravelerCheckSale.py Mon Nov 13 10:23:25 2006
@@ -49,6 +49,14 @@
execfile(os.path.join(sys.path[0], 'framework.py'))
class TestERP5BankingTravelerCheckSaleMixin:
+
+ def getTravelerCheckSaleModule(self):
+ """
+ Return the Traveler Check Sale Module
+ """
+ return getattr(self.getPortal(), 'traveler_check_sale_module', None)
+
+
def createCheckbookUsualCashTransferWithTravelerCheck(self, sequence=None,
sequence_list=None, **kwd):
@@ -73,53 +81,24 @@
wf_id='checkbook_usual_cash_transfer_workflow')
-class TestERP5BankingTravelerCheckSale(TestERP5BankingCheckbookUsualCashTransferMixin,
- TestERP5BankingTravelerCheckSaleMixin,
- TestERP5BankingMixin, ERP5TypeTestCase):
- """
- This class is a unit test to check the module of Cash Transfer
-
- Here are the following step that will be done in the test :
-
- XXX to be completed
-
- """
-
- login = PortalTestCase.login
-
- # pseudo constants
- RUN_ALL_TEST = 1 # we want to run all test
- QUIET = 0 # we don't want the test to be quiet
-
-
- def getTitle(self):
- """
- Return the title of the test
- """
- return "ERP5BankingTravelerCheckSale"
-
-
- def getBusinessTemplateList(self):
- """
- Return the list of business templates we need to run the test.
- This method is called during the initialization of the unit test by
- the unit test framework in order to know which business templates
- need to be installed to run the test on.
- """
- return ('erp5_base',
- 'erp5_trade',
- 'erp5_accounting',
- 'erp5_banking_core',
- 'erp5_banking_inventory',
- 'erp5_banking_check',
- )
-
- def getTravelerCheckSaleModule(self):
- """
- Return the Traveler Check Sale Module
- """
- return getattr(self.getPortal(), 'traveler_check_sale_module', None)
-
+ def stepCreateTravelerCheckSale(self, sequence=None, sequence_list=None, **kwd):
+ """
+ Create a traveler check sale
+ """
+ # We will do the transfer ot two items.
+ self.traveler_check_sale = self.traveler_check_sale_module.newContent(
+ id='traveler_check_sale', portal_type='Traveler Check Sale',
+ source_value=self.traveler_check_source, destination_value=None,
+ destination_payment_value=self.bank_account_1,
+ resource_value=self.currency_1,
+ start_date=self.date)
+ # check its portal type
+ self.assertEqual(self.traveler_check_sale.getPortalType(), 'Traveler Check Sale')
+ # check source
+ self.assertEqual(self.traveler_check_sale.getBaobabSource(),
+ 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies')
+ # check destination
+ self.assertEqual(self.traveler_check_sale.getBaobabDestination(), None)
def afterSetUp(self):
"""
@@ -181,6 +160,85 @@
self.openCounter(site=self.destination_site)
self.createCheckbookUsualCashTransferWithTravelerCheck()
+ def stepCreateTravelerCheckLineList(self, sequence=None, sequence_list=None, **kwd):
+ """
+ Create the checkbook
+ """
+ # This is not required to create checkbook items, they will be
+ # automatically created with the confirm action worfklow transition
+
+ # Add a line for check
+ self.line_1 = self.traveler_check_sale.newContent(quantity=1,
+ resource_value=self.traveler_check_model,
+ check_type_value=self.traveler_check_model.variant_1,
+ reference_range_min=52,
+ reference_range_max=52,
+ aggregate_value=self.traveler_check,
+ price_currency_value=self.currency_2
+ )
+
+
+ def stepDeliverTravelerCheckSale(self, sequence=None, sequence_list=None, **kw):
+ """
+ Deliver the traveler check sale
+ """
+ state = self.traveler_check_sale.getSimulationState()
+ # check that state is draft
+ self.assertEqual(state, 'draft')
+ self.workflow_tool.doActionFor(self.traveler_check_sale,
+ 'deliver_action',
+ wf_id='traveler_check_sale_workflow')
+ # get state of cash sorting
+ state = self.traveler_check_sale.getSimulationState()
+ # check that state is delivered
+ self.assertEqual(state, 'delivered')
+ # get workflow history
+ workflow_history = self.workflow_tool.getInfoFor(ob=self.traveler_check_sale,
+ name='history', wf_id='traveler_check_sale_workflow')
+ self.assertEqual(len(workflow_history), 3)
+
+class TestERP5BankingTravelerCheckSale(TestERP5BankingCheckbookUsualCashTransferMixin,
+ TestERP5BankingTravelerCheckSaleMixin,
+ TestERP5BankingMixin, ERP5TypeTestCase):
+ """
+ This class is a unit test to check the module of Cash Transfer
+
+ Here are the following step that will be done in the test :
+
+ XXX to be completed
+
+ """
+
+ login = PortalTestCase.login
+
+ # pseudo constants
+ RUN_ALL_TEST = 1 # we want to run all test
+ QUIET = 0 # we don't want the test to be quiet
+
+
+ def getTitle(self):
+ """
+ Return the title of the test
+ """
+ return "ERP5BankingTravelerCheckSale"
+
+
+ def getBusinessTemplateList(self):
+ """
+ Return the list of business templates we need to run the test.
+ This method is called during the initialization of the unit test by
+ the unit test framework in order to know which business templates
+ need to be installed to run the test on.
+ """
+ return ('erp5_base',
+ 'erp5_trade',
+ 'erp5_accounting',
+ 'erp5_banking_core',
+ 'erp5_banking_inventory',
+ 'erp5_banking_check',
+ )
+
+
def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
"""
@@ -216,62 +274,6 @@
self.assertEqual(self.simulation_tool.getCurrentInventory(payment=self.bank_account_1.getRelativeUrl()), 100000)
self.assertEqual(self.simulation_tool.getFutureInventory(payment=self.bank_account_1.getRelativeUrl()), 100000)
- def stepCreateTravelerCheckSale(self, sequence=None, sequence_list=None, **kwd):
- """
- Create a traveler check sale
- """
- # We will do the transfer ot two items.
- self.traveler_check_sale = self.traveler_check_sale_module.newContent(
- id='traveler_check_sale', portal_type='Traveler Check Sale',
- source_value=self.traveler_check_source, destination_value=None,
- destination_payment_value=self.bank_account_1,
- resource_value=self.currency_1,
- start_date=self.date)
- # check its portal type
- self.assertEqual(self.traveler_check_sale.getPortalType(), 'Traveler Check Sale')
- # check source
- self.assertEqual(self.traveler_check_sale.getBaobabSource(),
- 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies')
- # check destination
- self.assertEqual(self.traveler_check_sale.getBaobabDestination(), None)
-
-
- def stepCreateTravelerCheckLineList(self, sequence=None, sequence_list=None, **kwd):
- """
- Create the checkbook
- """
- # This is not required to create checkbook items, they will be
- # automatically created with the confirm action worfklow transition
-
- # Add a line for check
- self.line_1 = self.traveler_check_sale.newContent(quantity=1,
- resource_value=self.traveler_check_model,
- check_type_value=self.traveler_check_model.variant_1,
- reference_range_min=52,
- reference_range_max=52,
- aggregate_value=self.traveler_check,
- price_currency_value=self.currency_2
- )
-
-
- def stepDeliverTravelerCheckSale(self, sequence=None, sequence_list=None, **kw):
- """
- Deliver the traveler check sale
- """
- state = self.traveler_check_sale.getSimulationState()
- # check that state is draft
- self.assertEqual(state, 'draft')
- self.workflow_tool.doActionFor(self.traveler_check_sale,
- 'deliver_action',
- wf_id='traveler_check_sale_workflow')
- # get state of cash sorting
- state = self.traveler_check_sale.getSimulationState()
- # check that state is delivered
- self.assertEqual(state, 'delivered')
- # get workflow history
- workflow_history = self.workflow_tool.getInfoFor(ob=self.traveler_check_sale,
- name='history', wf_id='traveler_check_sale_workflow')
- self.assertEqual(len(workflow_history), 3)
def stepCheckFinalCheckbookInventory(self, sequence=None, sequence_list=None, **kw):
More information about the Erp5-report
mailing list