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
13ed96f7
Commit
13ed96f7
authored
Aug 23, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test claiming node subscription request
parent
66e58781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
1 deletion
+126
-1
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
...t.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
+126
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
View file @
13ed96f7
...
...
@@ -257,7 +257,8 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
new_subscription_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Subscription Request'
,
aggregate__uid
=
project
.
getUid
()
aggregate__uid
=
project
.
getUid
(),
simulation_state
=
'submitted'
)
self
.
assertEquals
(
new_subscription_request
.
getDestination
(),
owner_person
.
getRelativeUrl
())
...
...
@@ -284,3 +285,127 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
def
test_subscription_change_request_change_instance_destination_section_scenario
(
self
):
currency
,
_
,
_
,
sale_person
=
self
.
bootstrapVirtualMasterTest
(
is_virtual_master_accountable
=
False
)
self
.
tic
()
self
.
logout
()
with
PinnedDateTime
(
self
,
DateTime
(
'2024/01/25'
)):
# 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)
self
.
tic
()
# hooray, now it is time to create compute_nodes
self
.
logout
()
self
.
login
(
sale_person
.
getUserId
())
# create a default project
project_relative_url
=
self
.
addProject
(
person
=
owner_person
,
currency
=
currency
,
is_accountable
=
True
)
sale_supply
=
self
.
portal
.
sale_supply_module
.
newContent
(
portal_type
=
"Sale Supply"
,
title
=
"price for %s"
%
project_relative_url
,
source_project
=
project_relative_url
,
price_currency_value
=
currency
)
sale_supply
.
newContent
(
portal_type
=
"Sale Supply Line"
,
base_price
=
99
,
resource
=
"service_module/slapos_compute_node_subscription"
)
sale_supply
.
validate
()
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
.
tic
()
self
.
logout
()
self
.
login
(
owner_person
.
getUserId
())
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/25'
)):
public_server_title
=
'Public Server for %s'
%
owner_reference
compute_node_id
=
self
.
requestComputeNode
(
public_server_title
,
project
.
getReference
())
self
.
tic
()
self
.
login
(
sale_person
.
getUserId
())
subscription_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Subscription Request'
,
aggregate__reference
=
compute_node_id
)
owner_organisation
=
self
.
portal
.
organisation_module
.
newContent
(
title
=
'Test Owner Organisation'
,
vat_code
=
'1234567890'
)
owner_organisation
.
validate
()
new_trade_condition
=
owner_organisation
.
Organisation_claimSlaposSubscriptionRequest
(
subscription_request
.
getReference
(),
None
)
self
.
tic
()
self
.
logout
()
self
.
login
()
self
.
assertEquals
(
new_trade_condition
.
getDestination
(),
owner_person
.
getRelativeUrl
())
self
.
assertEquals
(
new_trade_condition
.
getDestinationSection
(),
owner_organisation
.
getRelativeUrl
())
self
.
assertEquals
(
new_trade_condition
.
getPortalType
(),
'Sale Trade Condition'
)
self
.
assertEquals
(
subscription_request
.
getSimulationState
(),
'cancelled'
)
new_subscription_request
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Subscription Request'
,
aggregate__reference
=
compute_node_id
,
simulation_state
=
'submitted'
)
self
.
assertEquals
(
new_subscription_request
.
getDestination
(),
owner_person
.
getRelativeUrl
())
self
.
assertEquals
(
new_subscription_request
.
getDestinationSection
(),
owner_organisation
.
getRelativeUrl
())
self
.
assertEquals
(
new_subscription_request
.
getSimulationState
(),
'submitted'
)
# If the script is called a second time,
# it should return the existing submitted Subscription Request
self
.
login
(
sale_person
.
getUserId
())
new_subscription_request_2
=
owner_organisation
.
Organisation_claimSlaposSubscriptionRequest
(
new_subscription_request
.
getReference
(),
None
)
self
.
assertEquals
(
new_subscription_request
.
getRelativeUrl
(),
new_subscription_request_2
.
getRelativeUrl
())
# Ensure no unexpected object has been created
# 1 compute node
# 1 open sale order
# 2 assignment
# 2 sale trade condition
# 2 sale supply*
# 3 sale trade conditions
# 3 subscription request
self
.
assertRelatedObjectCount
(
project
,
12
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
\ No newline at end of file
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