Commit 254d775e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_panel_ui_test: Create Trade condition for deposit and allow specific currency

   The currency as parameter is useful for bootstrap region specific
    tests later on, and allow reuse this script to bootstrap dev environment
    in EUR or CNY to test payments.
parent edecdca8
...@@ -22,7 +22,7 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self): ...@@ -22,7 +22,7 @@ def ERP5Site_activateAlarmSlapOSPanelTest(self):
def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login, def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login,
manager_login, remote_customer_login, manager_login, remote_customer_login,
passwd): passwd, currency=None):
if step not in ['trade_condition', 'account']: if step not in ['trade_condition', 'account']:
raise ValueError('Unsupported bootstrap step: %s' % step) raise ValueError('Unsupported bootstrap step: %s' % step)
...@@ -45,6 +45,7 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login, ...@@ -45,6 +45,7 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login,
portal.portal_alarms.upgrader_check_post_upgrade.activeSense(fixit=True) portal.portal_alarms.upgrader_check_post_upgrade.activeSense(fixit=True)
# Currency # Currency
if currency is None:
currency = portal.currency_module.newContent( currency = portal.currency_module.newContent(
portal_type="Currency", portal_type="Currency",
reference="test-currency-%s" % self.generateNewId(), reference="test-currency-%s" % self.generateNewId(),
...@@ -105,10 +106,21 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login, ...@@ -105,10 +106,21 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login,
trade_condition.validate() trade_condition.validate()
if scenario == 'accounting': if scenario == 'accounting':
# Sale trade condition
# Create trade condition for Deposit
portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference="Deposit for : %s" % currency.getRelativeUrl(),
trade_condition_type="deposit",
specialise_value=sale_trade_condition,
source_value=organisation,
source_section_value=organisation,
price_currency_value=currency).validate()
# Sale Supply for Virtual Master
sale_supply = portal.sale_supply_module.newContent( sale_supply = portal.sale_supply_module.newContent(
portal_type="Sale Supply", portal_type="Sale Supply",
title="Test project", title="Sale Supply for Virtual Master (%s)" % currency.getRelativeUrl(),
price_currency_value=currency, price_currency_value=currency,
) )
sale_supply.newContent( sale_supply.newContent(
...@@ -117,7 +129,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login, ...@@ -117,7 +129,6 @@ def ERP5Site_bootstrapSlapOSPanelTest(self, step, scenario, customer_login,
resource="service_module/slapos_virtual_master_subscription" resource="service_module/slapos_virtual_master_subscription"
) )
sale_supply.validate() sale_supply.validate()
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
......
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