[Erp5-report] r10388 - /erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Sep 28 12:17:54 CEST 2006
Author: seb
Date: Thu Sep 28 12:17:51 2006
New Revision: 10388
URL: http://svn.erp5.org?rev=10388&view=rev
Log:
created a mixin class
Modified:
erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py
Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py?rev=10388&r1=10387&r2=10388&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingMonetaryIssue.py Thu Sep 28 12:17:51 2006
@@ -46,107 +46,14 @@
execfile(os.path.join(sys.path[0], 'framework.py'))
-
-class TestERP5BankingMonetaryIssue(TestERP5BankingMixin, ERP5TypeTestCase):
- """
- This class is a unit test to check the module of Monetary Issue
-
- 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 "ERP5BankingMonetaryIssue"
-
-
- 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_cash'
- )
-
-
- def getMonetaryIssueModule(self):
- """
- Return the Cash Inventory Module
- """
- return getattr(self.getPortal(), 'monetary_issue_module', None)
-
-
- def getMonetaryReceptionModule(self):
- """
- Return the Cash Inventory Module
- """
- return getattr(self.getPortal(), 'monetary_reception_module', None)
-
-
- def afterSetUp(self):
- """
- Method called before the launch of the test to initialize some data
- """
- # Set some variables :
- self.initDefaultVariable()
- # get module
- self.monetary_issue_module = self.getMonetaryIssueModule()
- self.monetary_reception_module = self.getMonetaryReceptionModule()
- self.current_date = DateTime()
- self.createManagerAndLogin()
- self.createFunctionGroupSiteCategory()
- self.createBanknotesAndCoins()
- self.issue = self.paris.caveau.reserve.encaisse_des_billets_et_monnaies
- self.reception = self.paris.caveau.serre.encaisse_des_billets_neufs_non_emis
- self.checkUserFolderType()
- self.organisation = self.organisation_module.newContent(id='baobab_org', portal_type='Organisation',
- function='banking', group='baobab', site='testsite/paris')
- # define the user
- user_dict = {
- 'super_user' : [['Manager'], self.organisation, 'banking/comptable', 'baobab', 'testsite/paris']
- }
- # call method to create this user
- self.createERP5Users(user_dict)
- self.logout()
- self.login('super_user')
-
-
- def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
- """
- Check that all the objects we created in afterSetUp or
- that were added by the business template and that we rely
- on are really here.
- """
- self.checkResourceCreated()
- # check that MonetaryIssue Module was created
- self.assertEqual(self.monetary_issue_module.getPortalType(), 'Monetary Issue Module')
- # check cash inventory module is empty
- self.assertEqual(len(self.monetary_issue_module.objectValues()), 0)
-
+class TestERP5BankingMonetaryReceptionMixin:
def stepCreateMonetaryReception(self, sequence=None, sequence_list=None, **kw):
"""
Create a monetary reception to have some cash container to use in the issue test
"""
self.monetary_reception = self.monetary_reception_module.newContent(id='monetary_reception', portal_type='Monetary Reception',
- source_value=None, destination_value=self.reception,
+ source_value=None, destination_value=self.reception_site,
resource_value=self.currency_1, start_date=self.current_date)
self.stepTic()
# now create container
@@ -186,11 +93,11 @@
"""
self.simulation_tool = self.getSimulationTool()
# check source
- self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.reception.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 200.0)
- self.assertEqual(self.simulation_tool.getFutureInventory(node=self.reception.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 200.0)
+ self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.reception_site.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 200.0)
+ self.assertEqual(self.simulation_tool.getFutureInventory(node=self.reception_site.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 200.0)
# check destination
- self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.issue.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
- self.assertEqual(self.simulation_tool.getFutureInventory(node=self.issue.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
+ self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.destination_site.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
+ self.assertEqual(self.simulation_tool.getFutureInventory(node=self.destination_site.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
def stepCheckInitialContainerInventory(self, sequence=None, sequence_list=None, **kw):
@@ -199,6 +106,108 @@
"""
self.assertEqual(len(self.simulation_tool.getCurrentTrackingList(at_date=self.current_date, node=self.reception.getRelativeUrl())), 2)
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(at_date=self.current_date, node=self.reception.getRelativeUrl())), 2)
+
+
+class TestERP5BankingMonetaryIssue(TestERP5BankingMonetaryReceptionMixin, TestERP5BankingMixin, ERP5TypeTestCase):
+ """
+ This class is a unit test to check the module of Monetary Issue
+
+ 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 "ERP5BankingMonetaryIssue"
+
+
+ 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_cash'
+ )
+
+
+ def getMonetaryIssueModule(self):
+ """
+ Return the Cash Inventory Module
+ """
+ return getattr(self.getPortal(), 'monetary_issue_module', None)
+
+
+ def getMonetaryReceptionModule(self):
+ """
+ Return the Cash Inventory Module
+ """
+ return getattr(self.getPortal(), 'monetary_reception_module', None)
+
+
+ def afterSetUp(self):
+ """
+ Method called before the launch of the test to initialize some data
+ """
+ # Set some variables :
+ self.initDefaultVariable()
+ # get module
+ self.monetary_issue_module = self.getMonetaryIssueModule()
+ self.monetary_reception_module = self.getMonetaryReceptionModule()
+ self.current_date = DateTime()
+ self.createManagerAndLogin()
+ self.createFunctionGroupSiteCategory()
+ self.createBanknotesAndCoins()
+ self.issue = self.paris.caveau.reserve.encaisse_des_billets_et_monnaies
+ self.reception = self.paris.caveau.serre.encaisse_des_billets_neufs_non_emis
+ self.reception_site = self.reception
+ self.destination_site = self.issue
+ self.checkUserFolderType()
+ self.organisation = self.organisation_module.newContent(id='baobab_org', portal_type='Organisation',
+ function='banking', group='baobab', site='testsite/paris')
+ # define the user
+ user_dict = {
+ 'super_user' : [['Manager'], self.organisation, 'banking/comptable', 'baobab', 'testsite/paris']
+ }
+ # call method to create this user
+ self.createERP5Users(user_dict)
+ self.logout()
+ self.login('super_user')
+ # this is required in order to have some items
+ # in the source
+
+
+ def stepCheckObjects(self, sequence=None, sequence_list=None, **kwd):
+ """
+ Check that all the objects we created in afterSetUp or
+ that were added by the business template and that we rely
+ on are really here.
+ """
+ self.checkResourceCreated()
+ # check that MonetaryIssue Module was created
+ self.assertEqual(self.monetary_issue_module.getPortalType(), 'Monetary Issue Module')
+ # check cash inventory module is empty
+ self.assertEqual(len(self.monetary_issue_module.objectValues()), 0)
+
+
+
+
def stepCreateMonetaryIssue(self, sequence=None, sequence_list=None, **kwd):
@@ -283,7 +292,7 @@
# chek the value of the banknote
self.assertEqual(self.valid_line_1.getPrice(), 10000.0)
# check the unit of banknote
- self.assertEqual(self.valid_line_1.getQuantityUnit(), 'quantity_unit/unit')
+ self.assertEqual(self.valid_line_1.getQuantityUnit(), 'unit')
# check the destination variation text is redefine on destination
self.assertEqual(self.valid_line_1.getBaobabDestinationVariationText(), 'cash_status/new_emitted\nemission_letter/p\nvariation/2003')
# check we have one delivery cells
@@ -463,8 +472,9 @@
if not run: return
sequence_list = SequenceList()
# define the sequence
- sequence_string = 'Tic CheckObjects CreateMonetaryReception Tic ' \
- + 'CheckInitialInventory CheckInitialContainerInventory ' \
+ sequence_string = 'Tic CheckObjects CreateMonetaryReception Tic ' \
+ + 'CheckInitialInventory ' \
+ + 'CheckInitialContainerInventory ' \
+ 'CreateMonetaryIssue Tic ' \
+ 'CreateCashContainer Tic CheckCashDeliveryLine ' \
+ 'CheckCashContainer1 CheckCashContainer2 ' \
More information about the Erp5-report
mailing list