Commit e6bd5a9b authored by Gabriel Monnerat's avatar Gabriel Monnerat

add tests to validate if a slave instance is stopped and started when a...

add tests to validate if a slave instance is stopped and started when a software instance is started and stopped
parent 703791a9
...@@ -36,6 +36,7 @@ from Products.ERP5Type.tests.backportUnittest import skip ...@@ -36,6 +36,7 @@ from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \ from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod AssertPermissionMethod
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin from VifibMixin import testVifibMixin
from random import random from random import random
from slapos import slap from slapos import slap
...@@ -4491,7 +4492,6 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4491,7 +4492,6 @@ class TestVifibSlapWebService(testVifibMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
######################################### #########################################
# SlaveInstance.request # SlaveInstance.request
######################################### #########################################
...@@ -4701,6 +4701,16 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4701,6 +4701,16 @@ class TestVifibSlapWebService(testVifibMixin):
available slot available slot
""" """
def stepSlaveInstanceStarted(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.startComputerPartition()
def stepSlaveInstanceStopped(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.stopComputerPartition()
def test_SlaveInstance_request_start(self): def test_SlaveInstance_request_start(self):
""" """
Check that the Slave Instance will be started correctly Check that the Slave Instance will be started correctly
...@@ -4715,22 +4725,66 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4715,22 +4725,66 @@ class TestVifibSlapWebService(testVifibMixin):
LoginDefaultUser LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense ConfirmOrderedSaleOrderActiveSense
Tic Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginDefaultUser
SetSelectedComputerPartition
LoginTestVifibCustomer LoginTestVifibCustomer
RequestSoftwareInstanceStart SlaveInstanceStarted
Tic Tic
Logout Logout
LoginDefaultUser LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed CheckComputerPartitionInstanceSetupSalePackingListStarted
Logout Logout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_SlaveInstance_request_stop_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be stopped and started correctly when
a Software Instance is started/stopped
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
LoginTestVifibCustomer
SlaveInstanceStarted
Tic
SlapLogout
LoginDefaultUser
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SoftwareInstanceStopped
Tic
CheckComputerPartitionInstanceSetupSalePackingListDelivered
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_start_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be start and started correctly when
a Software Instance is started/stopped
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
LoginDefaultUser
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SoftwareInstanceStarted
Tic
CheckComputerPartitionInstanceSetupSalePackingListStarted
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_stop(self): def test_SlaveInstance_request_stop(self):
""" """
Check that the Slave Instance will be stopped correctly Check that the Slave Instance will be stopped correctly
...@@ -4745,14 +4799,16 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4745,14 +4799,16 @@ class TestVifibSlapWebService(testVifibMixin):
LoginDefaultUser LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense ConfirmOrderedSaleOrderActiveSense
Tic Tic
SlapLoginCurrentComputer LoginTestVifibCustomer
SoftwareInstanceAvailable SlaveInstanceStarted
Tic Tic
RequestSoftwareInstanceStop SlapLogout
LoginTestVifibCustomer
SlaveInstanceStopped
Tic Tic
Logout Logout
LoginDefaultUser LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListStopped CheckComputerPartitionInstanceSetupSalePackingListDelivered
Logout Logout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -4834,7 +4890,6 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -4834,7 +4890,6 @@ class TestVifibSlapWebService(testVifibMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_SlaveInstance_security_with_SoftwareInstance_user(self): def test_SlaveInstance_security_with_SoftwareInstance_user(self):
""" """
Check that the software instance user can access a Slave Instance Check that the software instance user can access a Slave Instance
...@@ -5998,6 +6053,25 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -5998,6 +6053,25 @@ class TestVifibSlapWebService(testVifibMixin):
REMOTE_USER = software_instance.getReference() REMOTE_USER = software_instance.getReference()
self.login(software_instance.getReference()) self.login(software_instance.getReference())
break break
def _getSoftwareInstanceFromCurrentComputerPartition(self, sequence):
query = ComplexQuery(
Query(aggregate_reference=sequence['computer_partition_reference']),
Query(aggregate_portal_type=self.software_instance_portal_type),
operator="AND")
software_instance = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
query=query).getAggregateValue(portal_type="Software Instance")
return software_instance
def stepStopSoftwareInstanceFromCurrentComputerPartition(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
software_instance.requestStopComputerPartition()
def stepStartSoftwareInstanceFromCurrentComputerPartition(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
software_instance.requestStartComputerPartition()
def stepCheckSalePackingListFromSlaveInstanceAccessUsingSoftwareInstanceUser(self, def stepCheckSalePackingListFromSlaveInstanceAccessUsingSoftwareInstanceUser(self,
sequence): sequence):
......
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