Commit 8a66e47d authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: improve test Trade Condition

parent ee5ee5c4
......@@ -194,7 +194,9 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
self.login(accountant_person.getUserId())
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title="fake currency"
reference="test-currency-%s" % self.generateNewId(),
short_title="tc%s" % self.generateNewId(),
base_unit_quantity=0.01
)
currency.validate()
......@@ -205,27 +207,51 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
now = DateTime()
seller_organisation = self.portal.organisation_module.newContent(
portal_type="Organisation",
title="seller-orga"
title="test-seller-%s" % self.generateNewId()
)
seller_bank_account = seller_organisation.newContent(
portal_type="Bank Account",
title="test_bank_account_%s" % self.generateNewId()
)
seller_organisation.validate()
sale_person.setCareerSubordinationValue(seller_organisation)
internal_trade_condition = self.portal.sale_trade_condition_module.newContent(
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='internal_for_%s' % seller_organisation.getTitle(),
reference='seller_organisation_%s' % seller_organisation.getTitle(),
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process",
source_value=seller_organisation,
source_section_value=seller_organisation,
source_payment_value=seller_bank_account,
price_currency_value=currency,
payment_condition_payment_mode='test-%s' % self.generateNewId()
)
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/%s' % currency.getRelativeUrl(),)
)
sale_trade_condition.validate()
sale_person.setCareerSubordinationValue(seller_organisation)
internal_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference='internal_for_%s' % seller_organisation.getTitle(),
# XXX hardcoded
specialise_value=sale_trade_condition,
destination_section_value=seller_organisation,
effective_date=now.earliestTime(),
price_currency_value=currency
effective_date=now.earliestTime()
)
internal_trade_condition.validate()
self.tic()
self.tic()
return web_site, now, currency, sale_person, seller_organisation, internal_trade_condition
def checkSiteConsistency(self):
......@@ -388,7 +414,7 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
"""
if len(subscription_request.checkConsistency()) != 0:
self.tic()
raise NotImplementedError('nope')
raise NotImplementedError(str(subscription_request.checkConsistency()[0]))
subscription_request.submit()
self.tic()
......@@ -568,7 +594,7 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
portal_type="Sale Trade Condition",
reference='user_for_%s' % customer_person.getTitle(),
# XXX hardcoded
specialise_value=internal_trade_condition,
specialise_value=internal_trade_condition.getSpecialiseValue(),
#source_value=seller_organisation,
#source_section_value=seller_organisation,
destination_value=customer_person,
......@@ -577,6 +603,19 @@ class TestSlapOSVirtualMasterSubscriptionRequestScenario(TestSlapOSVirtualMaster
#price_currency_value=currency
)
user_trade_condition.validate()
sale_supply = self.portal.sale_supply_module.newContent(
portal_type="Sale Supply",
source_section=internal_trade_condition.getSpecialiseValue().getSourceSection(),
start_date_range_min=now.earliestTime(),
price_currency=internal_trade_condition.getSpecialiseValue().getPriceCurrency()
)
sale_supply.newContent(
portal_type="Sale Supply Line",
base_price=345,
resource="service_module/slapos_virtual_master_subscription"
)
sale_supply.validate()
self.tic()
self.logout()
......
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