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
ac516e90
Commit
ac516e90
authored
Sep 30, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test request scenario with accounting
parent
68167e01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
212 additions
and
0 deletions
+212
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
...mponents/test.erp5.testSlapOSERP5VirtualMasterScenario.py
+212
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5VirtualMasterScenario.py
View file @
ac516e90
...
@@ -159,6 +159,218 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
...
@@ -159,6 +159,218 @@ class TestSlapOSVirtualMasterScenario(DefaultScenarioMixin):
assert
last_message
is
None
,
last_message
assert
last_message
is
None
,
last_message
def
test_virtual_master_with_accounting_scenario
(
self
):
# create a default project
project
=
self
.
addProject
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
slapos_master_panel
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
()
]
)
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
# 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
)
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
=
self
.
portal
.
software_product_module
.
newContent
(
portal_type
=
"Software Product"
,
title
=
"foo software product"
,
follow_up_value
=
project
,
quantity_unit
=
'time/month'
,
)
software_product
.
newContent
(
portal_type
=
"Software Product Release Variation"
,
title
=
"my super release"
,
url_string
=
public_server_software
)
software_product
.
newContent
(
portal_type
=
"Software Product Type Variation"
,
title
=
"my super type"
)
software_product
.
validate
()
# XXX Put price in sale supply module
sale_trade_condition
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
9
,
resource_value
=
software_product
)
# some preparation
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
()
# 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
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
())
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
self
.
setAccessToMemcached
(
public_server
)
self
.
assertNotEqual
(
None
,
public_server
)
self
.
setServerOpenPublic
(
public_server
)
# and install some software on them
self
.
supplySoftware
(
public_server
,
public_server_software
)
# format the compute_nodes
self
.
formatComputeNode
(
public_server
)
# join as the another visitor and request software instance on public
# compute_node
self
.
logout
()
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_type
=
'public type'
self
.
checkInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
public_server
,
project
.
getReference
())
# XXX Do this for every scenario tests
self
.
logout
()
for
_
in
range
(
20
):
self
.
stepCallAlarmList
()
self
.
tic
()
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
public_reference
).
getParentValue
()
self
.
login
(
owner_person
.
getUserId
())
# and the instances
self
.
checkInstanceUnallocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
public_server
,
project
.
getReference
())
# and uninstall some software on them
self
.
logout
()
self
.
login
(
owner_person
.
getUserId
())
self
.
supplySoftware
(
public_server
,
public_server_software
,
state
=
'destroyed'
)
self
.
logout
()
# Uninstall from compute_node
self
.
login
()
self
.
simulateSlapgridSR
(
public_server
)
self
.
tic
()
# XXX Do this for every scenario tests
# XXX Do this for every scenario tests
self
.
logout
()
for
_
in
range
(
20
):
self
.
stepCallAlarmList
()
self
.
tic
()
self
.
login
()
# Check stock
inventory_list
=
self
.
portal
.
portal_simulation
.
getCurrentInventoryList
(
**
{
'group_by_section'
:
False
,
'group_by_node'
:
True
,
'group_by_variation'
:
True
,
'resource_uid'
:
software_product
.
getUid
(),
'node_uid'
:
public_person
.
getUid
(),
'project_uid'
:
project
.
getUid
(),
'ledger_uid'
:
self
.
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
})
assert
len
(
inventory_list
)
==
1
,
len
(
inventory_list
)
assert
inventory_list
[
0
].
quantity
==
1
,
inventory_list
[
0
].
quantity
resource_vcl
=
list
(
software_product
.
getVariationCategoryList
(
omit_individual_variation
=
0
))
resource_vcl
.
sort
()
assert
inventory_list
[
0
].
getVariationCategoryList
()
==
resource_vcl
,
inventory_list
[
0
].
getVariationCategoryList
()
# Check accounting
transaction_list
=
self
.
portal
.
account_module
.
receivable
.
Account_getAccountingTransactionList
(
mirror_section_uid
=
public_person
.
getUid
())
assert
len
(
transaction_list
)
==
1
,
len
(
transaction_list
)
assert
transaction_list
[
0
].
total_price
==
10.8
,
transaction_list
[
0
].
total_price
self
.
login
()
# Ensure no unexpected object has been created
# 3 (can reduce to 2) assignment, 1 instance tree, 1 compute node, 1 software installation
# 1 software instance
# 2 credential request
# 1 open order
# 2 accounting transaction
# 1 packing list
# 7 simulation mvt
# 1 software product
# 1 sale trace condition, 1 supply line
# 1 open order line / 1 cell
related_object_list
=
project
.
Base_getRelatedObjectList
(
**
{
'category.category_strict_membership'
:
1
})
assert
len
(
related_object_list
)
==
25
,
[
x
.
getRelativeUrl
()
for
x
in
related_object_list
]
self
.
stepcheckERP5Consistency
()
# after accept, an email is send containing the reset link
last_message
=
self
.
portal
.
MailHost
.
_last_message
assert
last_message
is
None
,
last_message
def
test_open_order_with_service_scenario
(
self
):
def
test_open_order_with_service_scenario
(
self
):
# create a default project
# create a default project
...
...
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