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
0
Merge Requests
0
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
Titouan Soulard
slapos.core
Commits
69c6cf99
Commit
69c6cf99
authored
Apr 13, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test: wip accounting scenario
parent
7254fc9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
8 deletions
+92
-8
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+92
-8
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
69c6cf99
...
...
@@ -91,9 +91,7 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
return
instance_node
class
TestSlapOSVirtualMasterScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
def
test_virtual_master_without_accounting_scenario
(
self
):
def
bootstrapVirtualMasterTest
(
self
):
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
# some preparation
preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
...
...
@@ -158,10 +156,54 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
reference
=
'seller_organisation_%s'
%
seller_organisation
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
#destination_project_value=project,
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_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
price_currency_value
=
currency
)
# XXX Put price in sale supply module
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
42
,
resource
=
"service_module/slapos_virtual_master_subscription"
)
sale_supply
.
validate
()
return
currency
,
seller_organisation
,
seller_bank_account
class
TestSlapOSVirtualMasterScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
def
test_virtual_master_without_accounting_scenario
(
self
):
currency
,
seller_organisation
,
seller_bank_account
=
self
.
bootstrapVirtualMasterTest
()
# Create Trade Condition to create Project
sale_trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
reference
=
'free_for_organisation_%s'
%
seller_organisation
.
getTitle
(),
# XXX hardcoded
specialise
=
"business_process_module/slapos_ultimate_business_process"
,
#destination_project_value=project,
source_value
=
seller_organisation
,
#source_section_value=seller_organisation,
source_payment_value
=
seller_bank_account
,
destination_section_value
=
seller_organisation
,
price_currency_value
=
currency
,
payment_condition_payment_mode
=
'test-%s'
%
self
.
generateNewId
()
...
...
@@ -314,9 +356,36 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
def
test_virtual_master_with_accounting_scenario
(
self
):
currency
,
_
,
_
=
self
.
bootstrapVirtualMasterTest
()
self
.
logout
()
# lets join as slapos administrator, which will own few compute_nodes
owner_reference
=
'owner-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
owner_reference
)
self
.
login
()
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
owner_reference
).
getParentValue
()
#owner_person.setCareerSubordinationValue(seller_organisation)
"""
# first slapos administrator assignment can only be created by
# the erp5 manager
self.addProjectProductionManagerAssignment(owner_person, project)"""
self
.
tic
()
# hooray, now it is time to create compute_nodes
self
.
logout
()
self
.
login
(
owner_person
.
getUserId
())
# create a default project
project
=
self
.
addProject
(
is_accountable
=
True
)
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
project_relative_url
=
self
.
addProject
(
person
=
owner_person
)
self
.
logout
()
self
.
login
()
project
=
self
.
portal
.
restrictedTraverse
(
project_relative_url
)
preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
preference
.
edit
(
...
...
@@ -336,8 +405,9 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
destination_project_value
=
project
,
price_currency_value
=
project
.
getSpecialiseValue
().
getPriceCurrencyValue
()
title
=
"price for %s"
%
software_product
.
getRelativeUrl
(),
source_project_value
=
project
,
price_currency_value
=
currency
)
# XXX Put price in sale supply module
sale_supply
.
newContent
(
...
...
@@ -347,6 +417,20 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
)
sale_supply
.
validate
()
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for compute node"
,
destination_project_value
=
project
,
price_currency_value
=
currency
)
# XXX Put price in sale supply module
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
# some preparation
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