Commit 9523a793 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Minor clean up on test for allow us overwrite methods more easily

parent fef02529
Pipeline #17731 failed with stage
in 0 seconds
...@@ -117,7 +117,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin): ...@@ -117,7 +117,8 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
"""Overwrite this function on project context to tweak production focus tests""" """Overwrite this function on project context to tweak production focus tests"""
pass pass
def makeCustomOrganisation(self, new_id=None, index=True): def makeCustomOrganisation(self, new_id=None, index=True,
price_currency="currency_module/EUR"):
# Create a custom organisation same as slapos, for ensure we can have # Create a custom organisation same as slapos, for ensure we can have
# multiple organisations working on the site # multiple organisations working on the site
...@@ -140,6 +141,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin): ...@@ -140,6 +141,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
self.assertEqual("currency_module/EUR", self.assertEqual("currency_module/EUR",
custom_organisation.getPriceCurrency()) custom_organisation.getPriceCurrency())
custom_organisation.setPriceCurrency(price_currency)
self.assertNotEqual(getattr(custom_organisation, "bank_account", None), None) self.assertNotEqual(getattr(custom_organisation, "bank_account", None), None)
if index: if index:
...@@ -709,11 +711,11 @@ return %s""" % (script_name, fake_return )) ...@@ -709,11 +711,11 @@ return %s""" % (script_name, fake_return ))
) )
self.tic() self.tic()
def redefineAccountingTemplatesonPreferences(self): def redefineAccountingTemplatesonPreferences(self, price_currency="currency_module/EUR"):
# Define a new set of templates and change organisation on them, in this way tests should # Define a new set of templates and change organisation on them, in this way tests should
# behave the same. # behave the same.
self.login() self.login()
organisation = self.makeCustomOrganisation() organisation = self.makeCustomOrganisation(price_currency=price_currency)
accounting_module = self.portal.accounting_module accounting_module = self.portal.accounting_module
sale_packing_list_module = self.portal.sale_packing_list_module sale_packing_list_module = self.portal.sale_packing_list_module
...@@ -787,10 +789,10 @@ return %s""" % (script_name, fake_return )) ...@@ -787,10 +789,10 @@ return %s""" % (script_name, fake_return ))
# behave the same. # behave the same.
self.login() self.login()
fr_organisation = self.makeCustomOrganisation() fr_organisation = self.makeCustomOrganisation()
zh_organisation = self.makeCustomOrganisation() zh_organisation = self.makeCustomOrganisation(
price_currency="currency_module/CNY")
# Update Price currency for Chinese company # Update Price currency for Chinese company
zh_organisation.setPriceCurrency("currency_module/CNY")
accounting_module = self.portal.accounting_module accounting_module = self.portal.accounting_module
sale_packing_list_module = self.portal.sale_packing_list_module sale_packing_list_module = self.portal.sale_packing_list_module
......
...@@ -25,7 +25,8 @@ class testSlapOSSubscriptionNewTemplateChineseScenario(TestSlapOSSubscriptionChi ...@@ -25,7 +25,8 @@ class testSlapOSSubscriptionNewTemplateChineseScenario(TestSlapOSSubscriptionChi
def afterSetUp(self): def afterSetUp(self):
TestSlapOSSubscriptionChineseScenarioMixin.afterSetUp(self) TestSlapOSSubscriptionChineseScenarioMixin.afterSetUp(self)
organisation = self.redefineAccountingTemplatesonPreferences() organisation = self.redefineAccountingTemplatesonPreferences(
price_currency="currency_module/CNY")
self.expected_source = organisation.getRelativeUrl() self.expected_source = organisation.getRelativeUrl()
self.expected_source_section = organisation.getRelativeUrl() self.expected_source_section = organisation.getRelativeUrl()
......
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