Commit c31e64ba authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test: use share code to create accountable project

parent 2fd98484
......@@ -202,7 +202,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
def test_virtual_master_with_accounting_scenario(self):
# create a default project
project = self.addProject()
project = self.addProject(is_accountable=True)
self.web_site = self.portal.web_site_module.slapos_master_panel
preference = self.portal.portal_preferences.slapos_default_system_preference
......@@ -217,41 +217,6 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
public_server_software = self.generateNewSoftwareReleaseUrl()
public_instance_type = 'public type'
# XXX who create the product
# define the security
organisation = self.portal.organisation_module.newContent(
portal_type="Organisation"
)
# XXX Hardcoded ID
organisation.newContent(
portal_type="Bank Account",
id="bank_account"
)
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='slapos_ultimate_trade_condition',
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process",
destination_project_value=project,
source_value=organisation,
source_section_value=organisation,
price_currency="currency_module/EUR"
)
sale_trade_condition.newContent(
portal_type="Trade Model Line",
reference="VAT",
resource="service_module/slapos_tax",
base_application="base_amount/invoicing/taxable",
trade_phase="slapos/tax",
price=0.2,
quantity=1.0,
membership_criterion_base_category=('price_currency',),
membership_criterion_category=('price_currency/currency_module/EUR',)
)
sale_trade_condition.validate()
software_product, release_variation, type_variation = self.addSoftwareProduct(
"instance product", project, public_server_software, public_instance_type
)
......@@ -259,7 +224,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
sale_supply = self.portal.sale_supply_module.newContent(
portal_type="Sale Supply",
destination_project_value=project,
price_currency="currency_module/EUR"
price_currency_value=project.getSpecialiseValue().getPriceCurrencyValue()
)
# XXX Put price in sale supply module
sale_supply.newContent(
......@@ -1108,7 +1073,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
def test_open_order_with_service_scenario(self):
# create a default project
project = self.addProject()
project = self.addProject(is_accountable=True)
person = self.portal.person_module.newContent(
portal_type="Person",
default_email_coordinate_text='a@example.org',
......@@ -1117,24 +1082,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
portal_type="Organisation"
)
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='slapos_ultimate_trade_condition',
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process"
)
sale_trade_condition.newContent(
portal_type="Trade Model Line",
reference="VAT",
resource="service_module/slapos_tax",
base_application="base_amount/invoicing/taxable",
trade_phase="slapos/tax",
price=0.2,
quantity=1.0,
membership_criterion_base_category=('price_currency',),
membership_criterion_category=('price_currency/currency_module/EUR',)
)
sale_trade_condition.validate()
sale_trade_condition = project.getSpecialiseValue()
service = self.portal.restrictedTraverse('service_module/slapos_virtual_master_subscription')
......@@ -1158,7 +1106,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
destination_value=person,
destination_section_value=person,
destination_decision_value=person,
price_currency='currency_module/EUR',
price_currency_value=sale_trade_condition.getPriceCurrencyValue(),
payment_mode="payzen",
start_date=start_date,
# Ensure stop date value is higher than start date
......@@ -1231,7 +1179,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
def test_open_order_with_software_product_scenario(self):
# create a default project
project = self.addProject()
project = self.addProject(is_accountable=True)
person = self.portal.person_module.newContent(
portal_type="Person",
default_email_coordinate_text='a@example.org',
......@@ -1240,24 +1188,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
portal_type="Organisation"
)
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='slapos_ultimate_trade_condition',
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process"
)
sale_trade_condition.newContent(
portal_type="Trade Model Line",
reference="VAT",
resource="service_module/slapos_tax",
base_application="base_amount/invoicing/taxable",
trade_phase="slapos/tax",
price=0.2,
quantity=1.0,
membership_criterion_base_category=('price_currency',),
membership_criterion_category=('price_currency/currency_module/EUR',)
)
sale_trade_condition.validate()
sale_trade_condition = project.getSpecialiseValue()
software_product = self.portal.software_product_module.newContent(
portal_type="Software Product",
......@@ -1298,7 +1229,7 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
destination_value=person,
destination_section_value=person,
destination_decision_value=person,
price_currency='currency_module/EUR',
price_currency_value=sale_trade_condition.getPriceCurrencyValue(),
payment_mode="payzen",
start_date=start_date,
# Ensure stop date value is higher than start date
......
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