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
587fff22
Commit
587fff22
authored
Apr 11, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test: use Subscription Request to bootstrap the project
parent
4d5af958
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
11 deletions
+96
-11
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+96
-11
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
587fff22
...
@@ -94,22 +94,87 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
...
@@ -94,22 +94,87 @@ class TestSlapOSVirtualMasterScenarioMixin(DefaultScenarioMixin):
class
TestSlapOSVirtualMasterScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
class
TestSlapOSVirtualMasterScenario
(
TestSlapOSVirtualMasterScenarioMixin
):
def
test_virtual_master_without_accounting_scenario
(
self
):
def
test_virtual_master_without_accounting_scenario
(
self
):
# create a default project
project
=
self
.
addProject
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
# some preparation
preference
=
self
.
portal
.
portal_preferences
.
slapos_default_system_preference
################################################################
preference
.
edit
(
# lets join as slapos accountant, which will manages currencies
preferred_subscription_assignment_category_list
=
[
self
.
logout
()
'function/customer'
,
accountant_reference
=
'accountant-%s'
%
self
.
generateNewId
()
'role/client'
,
self
.
joinSlapOS
(
self
.
web_site
,
accountant_reference
)
'destination_project/%s'
%
project
.
getRelativeUrl
()
self
.
login
()
]
accountant_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
accountant_reference
).
getParentValue
()
self
.
addAccountingManagerAssignment
(
accountant_person
)
self
.
tic
()
# hooray, now it is time to create accounting data
self
.
login
(
accountant_person
.
getUserId
())
currency
=
self
.
portal
.
currency_module
.
newContent
(
portal_type
=
"Currency"
,
reference
=
"test-currency-%s"
%
self
.
generateNewId
(),
short_title
=
"tc%s"
%
self
.
generateNewId
(),
base_unit_quantity
=
0.01
)
)
currency
.
validate
()
# some preparation
################################################################
# lets join as slapos sales manager, which will manages trade condition
self
.
logout
()
self
.
logout
()
sale_reference
=
'sales-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
sale_reference
)
self
.
login
()
sale_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
sale_reference
).
getParentValue
()
self
.
addSaleManagerAssignment
(
sale_person
)
self
.
tic
()
# hooray, now it is time to create sale data
self
.
login
(
sale_person
.
getUserId
())
seller_organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
"Organisation"
,
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
()
# Create Trade Condition to create Project
sale_trade_condition
=
self
.
portal
.
sale_trade_condition_module
.
newContent
(
portal_type
=
"Sale Trade Condition"
,
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
,
destination_section_value
=
seller_organisation
,
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
()
self
.
tic
()
self
.
logout
()
# lets join as slapos administrator, which will own few compute_nodes
# lets join as slapos administrator, which will own few compute_nodes
owner_reference
=
'owner-%s'
%
self
.
generateNewId
()
owner_reference
=
'owner-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
owner_reference
)
self
.
joinSlapOS
(
self
.
web_site
,
owner_reference
)
...
@@ -118,15 +183,35 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
...
@@ -118,15 +183,35 @@ class TestSlapOSVirtualMasterScenario(TestSlapOSVirtualMasterScenarioMixin):
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
portal_type
=
"ERP5 Login"
,
reference
=
owner_reference
).
getParentValue
()
reference
=
owner_reference
).
getParentValue
()
owner_person
.
setCareerSubordinationValue
(
seller_organisation
)
"""
# first slapos administrator assignment can only be created by
# first slapos administrator assignment can only be created by
# the erp5 manager
# the erp5 manager
self
.
addProjectProductionManagerAssignment
(
owner_person
,
project
)
self.addProjectProductionManagerAssignment(owner_person, project)
"""
self
.
tic
()
self
.
tic
()
# hooray, now it is time to create compute_nodes
# hooray, now it is time to create compute_nodes
self
.
login
(
owner_person
.
getUserId
())
self
.
login
(
owner_person
.
getUserId
())
# create a default project
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
(
preferred_subscription_assignment_category_list
=
[
'function/customer'
,
'role/client'
,
'destination_project/%s'
%
project
.
getRelativeUrl
()
]
)
self
.
logout
()
self
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
())
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
())
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
...
...
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