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
3ec46cb3
Commit
3ec46cb3
authored
Jun 04, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test: use fixed date to check the movement quantity
parent
86918ead
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
107 deletions
+89
-107
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
...t.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
+89
-107
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5SubscriptionChangeRequestScenario.py
View file @
3ec46cb3
...
...
@@ -6,6 +6,8 @@
##############################################################################
from
erp5.component.test.testSlapOSERP5VirtualMasterScenario
import
TestSlapOSVirtualMasterScenarioMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
PinnedDateTime
from
DateTime
import
DateTime
class
TestSlapOSSubscriptionChangeRequestScenarioMixin
(
TestSlapOSVirtualMasterScenarioMixin
):
...
...
@@ -20,84 +22,62 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
self
.
tic
()
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)
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
)
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
())
"""
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)
public_server.generateCertificate()
"""
# and install some software on them
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
public_instance_type
=
'public type'
"""
self.supplySoftware(public_server, public_server_software)
# format the compute_nodes
self.formatComputeNode(public_server)
software_product, release_variation, type_variation = self.addSoftwareProduct(
"""
self
.
addSoftwareProduct
(
"instance product"
,
project
,
public_server_software
,
public_instance_type
)
"""
self.addAllocationSupply("for compute node", public_server, software_product,
release_variation, type_variation)
self.tic()
self.logout()
"""
"""
self.login()
self.checkServiceSubscriptionRequest(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
)
public_reference2
=
'public2-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference2
)
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
)
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
())
# and install some software on them
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
public_instance_type
=
'public type'
self
.
addSoftwareProduct
(
"instance product"
,
project
,
public_server_software
,
public_instance_type
)
# join as the another visitor and request software instance on public
# compute_node
self
.
logout
()
with
PinnedDateTime
(
self
,
DateTime
(
'2024/01/29'
)):
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
with
PinnedDateTime
(
self
,
DateTime
(
'2024/01/31'
)):
public_reference2
=
'public2-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference2
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
...
...
@@ -115,35 +95,36 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
self
.
login
(
person_user_id
)
self
.
personRequestInstanceNotReady
(
software_release
=
software_release
,
software_type
=
software_type
,
partition_reference
=
public_instance_title
,
project_reference
=
project_reference
)
self
.
tic
()
# XXX search only for this user
instance_tree
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Instance Tree"
,
title
=
public_instance_title
,
follow_up__reference
=
project_reference
)
self
.
checkServiceSubscriptionRequest
(
instance_tree
)
self
.
tic
()
self
.
login
(
sale_person
.
getUserId
())
subscription_change_request
=
public_person2
.
Person_claimSlaposItemSubscription
(
instance_tree
.
getReference
(),
None
)
self
.
tic
()
self
.
logout
()
self
.
login
()
self
.
assertEquals
(
instance_tree
.
getDestinationSection
(),
public_person2
.
getRelativeUrl
())
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/03'
)):
self
.
personRequestInstanceNotReady
(
software_release
=
software_release
,
software_type
=
software_type
,
partition_reference
=
public_instance_title
,
project_reference
=
project_reference
)
self
.
tic
()
# XXX search only for this user
instance_tree
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Instance Tree"
,
title
=
public_instance_title
,
follow_up__reference
=
project_reference
)
self
.
checkServiceSubscriptionRequest
(
instance_tree
)
self
.
tic
()
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/10'
)):
self
.
login
(
sale_person
.
getUserId
())
subscription_change_request
=
public_person2
.
Person_claimSlaposItemSubscription
(
instance_tree
.
getReference
(),
None
)
self
.
tic
()
self
.
logout
()
self
.
login
()
self
.
assertEquals
(
instance_tree
.
getDestinationSection
(),
public_person2
.
getRelativeUrl
())
# Total of quantity should be zero
...
...
@@ -199,5 +180,6 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# 2 subscription request
self
.
assertRelatedObjectCount
(
project
,
28
)
self
.
checkERP5StateBeforeExit
()
with
PinnedDateTime
(
self
,
DateTime
(
'2024/02/15'
)):
self
.
checkERP5StateBeforeExit
()
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