Commit 3ec46cb3 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test: use fixed date to check the movement quantity

parent 86918ead
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
############################################################################## ##############################################################################
from erp5.component.test.testSlapOSERP5VirtualMasterScenario import TestSlapOSVirtualMasterScenarioMixin from erp5.component.test.testSlapOSERP5VirtualMasterScenario import TestSlapOSVirtualMasterScenarioMixin
from erp5.component.test.SlapOSTestCaseMixin import PinnedDateTime
from DateTime import DateTime
class TestSlapOSSubscriptionChangeRequestScenarioMixin(TestSlapOSVirtualMasterScenarioMixin): class TestSlapOSSubscriptionChangeRequestScenarioMixin(TestSlapOSVirtualMasterScenarioMixin):
...@@ -20,84 +22,62 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe ...@@ -20,84 +22,62 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
self.tic() self.tic()
self.logout() 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() with PinnedDateTime(self, DateTime('2024/01/25')):
owner_person = self.portal.portal_catalog.getResultValue( # lets join as slapos administrator, which will own few compute_nodes
portal_type="ERP5 Login", owner_reference = 'owner-%s' % self.generateNewId()
reference=owner_reference).getParentValue() self.joinSlapOS(self.web_site, owner_reference)
#owner_person.setCareerSubordinationValue(seller_organisation)
self.login()
self.tic() owner_person = self.portal.portal_catalog.getResultValue(
portal_type="ERP5 Login",
# hooray, now it is time to create compute_nodes reference=owner_reference).getParentValue()
self.logout() #owner_person.setCareerSubordinationValue(seller_organisation)
self.login(sale_person.getUserId())
self.tic()
# create a default project
project_relative_url = self.addProject(person=owner_person, currency=currency) # hooray, now it is time to create compute_nodes
self.logout()
self.logout() self.login(sale_person.getUserId())
self.login()
project = self.portal.restrictedTraverse(project_relative_url) # create a default project
preference = self.portal.portal_preferences.slapos_default_system_preference project_relative_url = self.addProject(person=owner_person, currency=currency)
preference.edit(
preferred_subscription_assignment_category_list=[ self.logout()
'function/customer', self.login()
'role/client', project = self.portal.restrictedTraverse(project_relative_url)
'destination_project/%s' % project.getRelativeUrl() preference = self.portal.portal_preferences.slapos_default_system_preference
] preference.edit(
) preferred_subscription_assignment_category_list=[
'function/customer',
self.tic() 'role/client',
'destination_project/%s' % project.getRelativeUrl()
self.logout() ]
self.login(owner_person.getUserId()) )
"""
self.tic()
public_server_title = 'Public Server for %s' % owner_reference
public_server_id = self.requestComputeNode(public_server_title, project.getReference()) self.logout()
public_server = self.portal.portal_catalog.getResultValue( self.login(owner_person.getUserId())
portal_type='Compute Node', reference=public_server_id)
self.setAccessToMemcached(public_server) # and install some software on them
self.assertNotEqual(None, public_server) public_server_software = self.generateNewSoftwareReleaseUrl()
self.setServerOpenPublic(public_server) public_instance_type = 'public type'
public_server.generateCertificate()
""" self.addSoftwareProduct(
# and install some software on them "instance product", project, public_server_software, public_instance_type
public_server_software = self.generateNewSoftwareReleaseUrl() )
public_instance_type = 'public type'
""" # join as the another visitor and request software instance on public
self.supplySoftware(public_server, public_server_software) # compute_node
self.logout()
# format the compute_nodes
self.formatComputeNode(public_server) with PinnedDateTime(self, DateTime('2024/01/29')):
software_product, release_variation, type_variation = self.addSoftwareProduct( public_reference = 'public-%s' % self.generateNewId()
""" self.joinSlapOS(self.web_site, public_reference)
self.addSoftwareProduct( with PinnedDateTime(self, DateTime('2024/01/31')):
"instance product", project, public_server_software, public_instance_type public_reference2 = 'public2-%s' % self.generateNewId()
) self.joinSlapOS(self.web_site, public_reference2)
"""
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)
self.login() self.login()
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
...@@ -115,35 +95,36 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe ...@@ -115,35 +95,36 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
public_instance_title = 'Public title %s' % self.generateNewId() public_instance_title = 'Public title %s' % self.generateNewId()
self.login(person_user_id) self.login(person_user_id)
self.personRequestInstanceNotReady( with PinnedDateTime(self, DateTime('2024/02/03')):
software_release=software_release, self.personRequestInstanceNotReady(
software_type=software_type, software_release=software_release,
partition_reference=public_instance_title, software_type=software_type,
project_reference=project_reference partition_reference=public_instance_title,
) project_reference=project_reference
self.tic() )
self.tic()
# XXX search only for this user
instance_tree = self.portal.portal_catalog.getResultValue( # XXX search only for this user
portal_type="Instance Tree", instance_tree = self.portal.portal_catalog.getResultValue(
title=public_instance_title, portal_type="Instance Tree",
follow_up__reference=project_reference title=public_instance_title,
) follow_up__reference=project_reference
self.checkServiceSubscriptionRequest(instance_tree) )
self.tic() self.checkServiceSubscriptionRequest(instance_tree)
self.tic()
self.login(sale_person.getUserId()) with PinnedDateTime(self, DateTime('2024/02/10')):
subscription_change_request = public_person2.Person_claimSlaposItemSubscription( self.login(sale_person.getUserId())
instance_tree.getReference(), subscription_change_request = public_person2.Person_claimSlaposItemSubscription(
None instance_tree.getReference(),
) None
)
self.tic()
self.logout() self.tic()
self.login() self.logout()
self.assertEquals(instance_tree.getDestinationSection(), self.login()
public_person2.getRelativeUrl()) self.assertEquals(instance_tree.getDestinationSection(),
public_person2.getRelativeUrl())
# Total of quantity should be zero # Total of quantity should be zero
...@@ -199,5 +180,6 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe ...@@ -199,5 +180,6 @@ class TestSlapOSSubscriptionChangeRequestScenario(TestSlapOSSubscriptionChangeRe
# 2 subscription request # 2 subscription request
self.assertRelatedObjectCount(project, 28) self.assertRelatedObjectCount(project, 28)
self.checkERP5StateBeforeExit() with PinnedDateTime(self, DateTime('2024/02/15')):
self.checkERP5StateBeforeExit()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment