Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
8a66e47d
Commit
8a66e47d
authored
Mar 29, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: improve test Trade Condition
parent
ee5ee5c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
11 deletions
+50
-11
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterSubscriptionRequestScenario.py
...testSlapOSERP5VirtualMasterSubscriptionRequestScenario.py
+50
-11
No files found.
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterSubscriptionRequestScenario.py
View file @
8a66e47d
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment