Commit ad2f613b authored by Romain Courteaud's avatar Romain Courteaud

Split testVifibSlapWebService.

It will reduce execution time.
parent 7d2851ca
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin):
########################################
# Computer.getComputerPartitionList
########################################
def test_Computer_getComputerPartitionList_validatedComputer(self):
"""
Check that getComputerPartitionList returns an empty result if the
validated computer is not related to any packing list.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_emptyPartition(self):
"""
Check that getComputerPartitionList returns nothing if Computer Partition
is not related with proper Sale Packing List Line
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_twoEmptyPartition(self):
"""
Check that getComputerPartitionList returns nothing if Computer Partitions
are not related with proper Sale Packing List Lines
"""
self.computer_partition_amount = 2
self.test_Computer_getComputerPartitionList_emptyPartition()
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getComputerPartitionList_unknowComputerUid(self):
sequence_list = SequenceList()
sequence_string = '\
SlapLoginRandomComputer \
CheckUnauthorizedSlapGetComputerPartitionListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getComputerPartitionList_draftComputer(self):
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout \
\
SlapLoginRandomComputer \
CheckUnauthorizedSlapGetComputerPartitionListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_validatedAndDraftComputer(self):
"""
Check that getComputerPartitionList returns an empty result if there are
one draft and one validated computer.
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout \
' + self.prepare_computer + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getComputerPartitionList_TwoValidatedComputer(self):
# XXX: It shall be part of VifibMachineAuthentication test suite
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
\
LoginDefaultUser \
DuplicateAndValidateCurrentComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckUnauthorizedSlapGetComputerPartitionListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
try:
sequence_list.play(self)
finally:
self.login('ERP5TypeTestCase')
for c in self.portal.computer_module.contentValues():
if c.getValidationState() == 'validated':
c.invalidate()
transaction.commit()
def test_Computer_getComputerPartitionList_SetupResource_CancelledState(self):
"""
Check that calling Computer.getComputerPartitionList works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListCancelled \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceCleanupSalePackingListCancelled \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_SetupResource_ConfirmedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_SetupResource_StartedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_SetupResource_StoppedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
LoginDefaultUser \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListStopped \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceHostingSalePackingListCancelled \
CheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_SetupResource_DeliveredState(self):
"""
Check that calling Computer.getComputerPartitionList works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
LoginDefaultUser \
DeliverSalePackingList \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListDelivered \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceHostingSalePackingListCancelled \
CheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists \
Logout \
\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_CancelledState(self):
"""
Check that calling Computer.getComputerPartitionList works in
cancelled state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_ConfirmedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
confirmed state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_StartedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
started state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_StartedState_with_slave(self):
"""
Check that calling Computer.getComputerPartitionList works in
started state with the hosting resource when a Slave Partition is present.
We validate checking more them one Slave Instance allocation.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
\
LoginTestVifibCustomer \
PersonRequestSlaveInstance \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListConfirmed \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SoftwareInstanceAvailable \
Tic \
CheckSuccessComputerGetComputerPartitionCall \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
SetDeliveryLineAmountEqualTwo \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
\
LoginTestVifibCustomer \
PersonRequestSlaveInstance \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
CheckSuccessComputerGetComputerPartitionCall \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
SetDeliveryLineAmountEqualThree \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
\
LoginTestVifibCustomer \
RequestSlaveInstanceStop \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
SetDeliveryLineAmountEqualTwo \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
SetDeliveryLineAmountEqualOne \
CheckComputerPartitionInstanceHostingSalePackingListDelivered \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_StoppedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
stopped state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stop_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_HostingResource_DeliveredState(self):
"""
Check that calling Computer.getComputerPartitionList works in
delivered state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_CleanupResource_CancelledState(self):
"""
Check that calling Computer.getComputerPartitionList works in
cancelled state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_CleanupResource_ConfirmedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
confirmed state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_CleanupResource_StartedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
started state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
StartSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_CleanupResource_StoppedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
stopped state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
StartSalePackingList \
Tic \
StopSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_CleanupResource_DeliveredState(self):
"""
Check that calling Computer.getComputerPartitionList works in
delivered state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroyed_computer_partition + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_AccountingResource_CancelledState(self):
"""
Check that calling Computer.getComputerPartitionList works in
cancelled state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
CancelSalePackingList \
Tic \
CheckComputerPartitionAccoutingResourceSalePackingListCancelled \
Logout \
\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_AccountingResource_ConfirmedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
confirmed state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_computer_partition_accounting_resource_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_AccountingResource_StartedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
started state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_computer_partition_accounting_resource_started_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_AccountingResource_StoppedState(self):
"""
Check that calling Computer.getComputerPartitionList works in
stopped state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_computer_partition_accounting_resource_stopped_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_AccountingResource_DeliveredState(self):
"""
Check that calling Computer.getComputerPartitionList works in
delivered state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_computer_partition_accounting_resource_delivered_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getComputerPartitionList_twoSalePackingList(self):
"""
Check that calling Computer.getComputerPartitionList uses the latest sale packing
list for calculation
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SetHostingAfterSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
Tic \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
SetHostingBeforeSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerGetComputerPartitionList))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin):
########################################
# Computer.getSoftwareReleaseList
########################################
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getSoftwareReleaseList_unknowComputerUid(self):
sequence_list = SequenceList()
sequence_string = '\
SlapLoginRandomComputer \
CheckUnauthorizedComputerGetSoftwareReleaseListCall \
Tic \
SlapLogout \
CheckUnexistingComputer \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getSoftwareReleaseList_draftComputer(self):
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckUnauthorizedComputerGetSoftwareReleaseListCall \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_validatedComputer(self):
"""
Check that getSoftwareReleaseList returns an empty result if the
validated computer is not related to any packing list.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_validatedAndDraftComputer(self):
"""
Check that getSoftwareReleaseList returns an empty result if there are
one draft and one validated computer.
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout '\
+ self.prepare_computer + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_Computer_getSoftwareReleaseList_TwoValidatedComputer(self):
# XXX: It shall be part of VifibMachineAuthentication test suite
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
LoginDefaultUser \
DuplicateAndValidateCurrentComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckUnauthorizedComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
try:
sequence_list.play(self)
finally:
self.login('ERP5TypeTestCase')
for c in self.portal.computer_module.contentValues():
if c.getValidationState() == 'validated':
c.invalidate()
transaction.commit()
def test_Computer_getSoftwareReleaseList_SetupResource_ConfirmedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_SetupResource_CancelledState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_SetupResource_StartedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_SetupResource_StoppedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_SetupResource_DeliveredState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_AccountingResource_ConfirmedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
confirmed state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list_accounting_resource + '\
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_AccountingResource_CancelledState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
cancelled state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list_accounting_resource + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_AccountingResource_StartedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
started state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list_accounting_resource + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_AccountingResource_StoppedState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
stopped state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list_accounting_resource + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_AccountingResource_DeliveredState(self):
"""
Check that calling Computer.getSoftwareReleaseList works in
delivered state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list_accounting_resource + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetCurrentPurchasePackingListAsA(self, sequence):
sequence.edit(purchase_packing_list_a_uid=sequence[
'purchase_packing_list_uid'])
def stepSetCurrentPurchasePackingListAsB(self, sequence):
sequence.edit(purchase_packing_list_b_uid=sequence[
'purchase_packing_list_uid'])
def stepStepPurchasePackingListBStartDateAfterPurchasePackingListA(self,
sequence):
a = self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_a_uid'])
b = self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid'])
b.setStartDate(a.getStartDate() + 2)
def stepStepPurchasePackingListBStartDateBeforePurchasePackingListA(self,
sequence):
a = self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_a_uid'])
b = self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid'])
b.setStartDate(a.getStartDate() - 2)
def stepCheckStoppedPurchasePackingListA(self, sequence):
self.assertEqual('stopped',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_a_uid']).getSimulationState())
def stepCheckConfirmedPurchasePackingListB(self, sequence):
self.assertEqual('confirmed',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid']).getSimulationState())
def stepCheckStartedPurchasePackingListB(self, sequence):
self.assertEqual('started',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid']).getSimulationState())
def stepCheckStoppedPurchasePackingListB(self, sequence):
self.assertEqual('stopped',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid']).getSimulationState())
def stepCheckSlaveInstanceSecurityWithDifferentCustomer(self, sequence):
software_instance_uid = sequence["software_instance_uid"]
portal_membership = self.portal.portal_membership
username = portal_membership.getAuthenticatedMember().getUserName()
self.login()
software_instance = self.portal.portal_catalog.getResultValue(
uid=software_instance_uid)
self.failIfUserCanViewDocument(username, software_instance)
self.failIfUserCanAccessDocument(username, software_instance)
self.login(username)
def stepCheckTwoSlaveInstanceRequest(self, sequence):
computer_partition = self.portal.portal_catalog.getResultValue(
uid=sequence["computer_partition_uid"])
sale_packing_list_line_list = computer_partition.getAggregateRelatedValueList(
portal_type=self.sale_packing_list_line_portal_type)
portal_type_list = [self.software_instance_portal_type,
self.slave_instance_portal_type]
instance_list = filter(None, [obj.getAggregateValue(portal_type=portal_type_list) \
for obj in sale_packing_list_line_list])
portal_type_list = [instance.getPortalType() for instance in instance_list]
expected_portal_type_list = [self.slave_instance_portal_type,
self.slave_instance_portal_type,
self.software_instance_portal_type]
self.assertEquals(expected_portal_type_list, sorted(portal_type_list))
computer_partition_list = [obj.getAggregateValue(
portal_type=self.computer_partition_portal_type) \
for obj in sale_packing_list_line_list]
uid_list = [computer_partition.getUid() \
for computer_partition in computer_partition_list]
self.assertEquals(1, len(set(uid_list)))
def stepCheckSlaveInstanceReady(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_order_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_order_line_portal_type)
self.assertEquals("confirmed", sale_order_line.getSimulationState())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
self.assertNotEquals(sale_packing_list_line.getAggregateValue(
portal_type=self.computer_partition_portal_type), None)
def stepCheckSlaveInstanceAssociationWithSoftwareInstance(self, sequence):
portal_catalog = self.portal.portal_catalog
computer_partition_reference_list = \
sequence['computer_partition_reference_list']
for reference in computer_partition_reference_list:
computer_partition = portal_catalog.getResultValue(
portal_type="Computer Partition", reference=reference)
sale_packing_list_line_list = portal_catalog(
portal_type="Sale Packing List Line",
aggregate_relative_url=computer_partition.getRelativeUrl())
software_release_uri_list = []
for sale_packing_list_line in sale_packing_list_line_list:
software_release_uri = sale_packing_list_line.getResultValue(
portal_type="Software Release")
software_release_uri_list.append(software_release_uri.getUrlString())
self.assertEquals(1, len(set(software_release_uri_list)))
def stepCheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
software_release = sale_packing_list_line.getAggregateValue(
portal_type=self.software_release_portal_type)
sale_packing_list_line_list = software_release.aggregateRelatedValues(
portal_type=self.sale_packing_list_line_portal_type)
computer_partition_list = [obj.getAggregateValue(
portal_type=self.computer_partition_portal_type)\
for obj in sale_packing_list_line_list]
self.assertEquals(computer_partition_list[0],
computer_partition_list[1])
self.assertEquals(computer_partition_list[0].getReference(),
computer_partition_list[1].getReference())
self.assertEquals(2, len(computer_partition_list))
def stepCheckSlaveInstanceNotReady(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEquals(self.slave_instance_portal_type,
slave_instance.getPortalType())
sale_order_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_order_line_portal_type)
self.assertEquals("ordered", sale_order_line.getSimulationState())
self.assertRaises(ValueError, sale_order_line.confirm)
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
self.assertEquals(sale_packing_list_line, None)
def stepSelectSlaveInstanceFromOneComputerPartition(self, sequence):
slave_instance = self._getSlaveInstanceFromCurrentComputerPartition(sequence)
sequence.edit(software_instance_uid=slave_instance.getUid())
def stepCheckEmptySlaveInstanceListFromOneComputerPartition(self, sequence):
computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
computer_partition = self.slap.registerComputerPartition(computer_guid,
partition_id)
parameter_dict = computer_partition.getInstanceParameterDict()
slave_instance_list = parameter_dict["slave_instance_list"]
self.assertEquals([], slave_instance_list)
def stepCheckSlaveInstanceListFromOneComputerPartition(self, sequence,
expected_amount=1):
computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
computer_partition = self.slap.registerComputerPartition(computer_guid,
partition_id)
parameter_dict = computer_partition.getInstanceParameterDict()
self.assertEquals("RootSoftwareInstance",
parameter_dict["slap_software_type"])
slave_instance_list = parameter_dict["slave_instance_list"]
self.assertEquals(expected_amount, len(slave_instance_list))
for slave_instance in slave_instance_list:
self.assertEquals("SlaveInstance", slave_instance["slap_software_type"])
def stepCheckTwoSlaveInstanceListFromOneComputerPartition(self, sequence):
self.stepCheckSlaveInstanceListFromOneComputerPartition(sequence,
expected_amount=2)
def stepCheckSlaveInstanceAccessUsingCurrentSoftwareInstanceUser(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
portal_membership = self.portal.portal_membership
username = portal_membership.getAuthenticatedMember().getUserName()
self.assertUserCanViewDocument(username, slave_instance)
self.assertUserCanAccessDocument(username, slave_instance)
def stepSlapLoginSoftwareInstanceFromCurrentSoftwareInstance(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
self.assertNotEquals(None, software_instance)
self.stepSlapLogout()
global REMOTE_USER
REMOTE_USER = software_instance.getReference()
self.login(software_instance.getReference())
def _getSoftwareInstanceFromCurrentComputerPartition(self, sequence):
query = ComplexQuery(
Query(aggregate_uid=sequence['computer_partition_uid']),
Query(aggregate_portal_type=self.software_instance_portal_type),
operator="AND")
software_instance = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
sort_on=(('movement.start_date', 'DESC'),),
query=query).getAggregateValue(portal_type="Software Instance")
return software_instance
def _getSlaveInstanceFromCurrentComputerPartition(self, sequence):
query = ComplexQuery(
Query(aggregate_uid=sequence['computer_partition_uid']),
Query(aggregate_portal_type=self.slave_instance_portal_type),
operator="AND")
slave_instance = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
query=query).getAggregateValue(portal_type=self.slave_instance_portal_type)
return slave_instance
def stepRequestDestroySoftwareInstanceFromCurrentComputerPartition(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
software_instance.requestDestroyComputerPartition()
def stepStartSoftwareInstanceFromCurrentComputerPartition(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
software_instance.requestStartComputerPartition()
def stepRequestStopSoftwareInstanceFromCurrentComputerPartition(self,
sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
software_instance.requestStopComputerPartition()
def stepCheckSalePackingListFromSlaveInstanceAccessUsingSoftwareInstanceUser(self,
sequence):
portal_membership = self.portal.portal_membership
sale_packing_list_line = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
uid=sequence["sale_packing_list_line_uid"])
username = portal_membership.getAuthenticatedMember().getUserName()
self.assertUserCanViewDocument(username, sale_packing_list_line)
self.failIfUserCanModifyDocument(username, sale_packing_list_line)
def stepCheckSaleOrderFromSlaveInstanceAccessUsingSoftwareInstanceUser(self,
sequence):
portal_membership = self.portal.portal_membership
sale_order = self.portal.portal_catalog.getResultValue(
portal_type="Sale Order",
uid=sequence["sale_order_uid"])
username = portal_membership.getAuthenticatedMember().getUserName()
self.assertUserCanViewDocument(username, sale_order)
self.failIfUserCanModifyDocument(username, sale_order)
def stepCheckHostingSubscriptionFromSlaveInstanceAccessUsingSoftwareInstanceUser(self,
sequence):
portal_membership = self.portal.portal_membership
sale_packing_list_line = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
uid=sequence["sale_packing_list_line_uid"])
hosting_subscription = sale_packing_list_line.getAggregateValue(
portal_type="Hosting Subscription")
username = portal_membership.getAuthenticatedMember().getUserName()
self.assertUserCanViewDocument(username, hosting_subscription)
self.failIfUserCanModifyDocument(username, hosting_subscription)
def stepStoreSaleOrderFromSlaveInstance(self, sequence):
sale_order_line = self.portal.portal_catalog.getResultValue(
portal_type="Sale Order Line",
aggregate_reference=sequence["software_instance_reference"])
sequence.edit(sale_order_line_uid=sale_order_line.getUid(),
sale_order_uid=sale_order_line.getParent().getUid())
def stepStoreSalePackingListLineFromSlaveInstance(self, sequence):
sale_packing_list_line = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
aggregate_uid=sequence["software_instance_uid"])
sequence.edit(sale_packing_list_line_uid=sale_packing_list_line.getUid(),
sale_packing_list_uid=sale_packing_list_line.getParent().getUid())
def stepSetConnectionXmlToSlaveInstance(self, sequence):
computer_reference = sequence["computer_reference"]
computer_partition_reference = sequence["computer_partition_reference"]
site_url = "https://www.example.com:8080/"
connection_dict = dict(site_url=site_url)
slave_reference = sequence["software_instance_reference"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
computer_partition = self.slap.registerComputerPartition(
computer_reference, computer_partition_reference)
computer_partition.setConnectionDict(connection_dict)
sequence.edit(site_url=site_url)
connection_dict["site_url"] += "DeF45uef"
computer_partition.setConnectionDict(connection_dict,
slave_reference)
sequence.edit(slave_instance_site_url=site_url)
def stepCheckConnectionXmlFromSlaveInstance(self, sequence):
portal_catalog = self.portal.portal_catalog
slave_instance = portal_catalog.getResultValue(
reference=sequence["software_instance_reference"])
self.assertTrue(sequence["slave_instance_site_url"] in \
slave_instance.getConnectionXml())
def stepCheckConnectionXmlFromSoftwareInstance(self, sequence):
software_instance = self.portal.portal_catalog.getResultValue(
portal_type="Software Instance")
self.assertTrue("%s</parameter>" % sequence["site_url"] in \
software_instance.getConnectionXml())
def stepSlaveInstanceStarted(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.startComputerPartition()
def stepRequestSlaveInstanceStart(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.requestStartComputerPartition()
def stepRequestSlaveInstanceStop(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.requestStopComputerPartition()
def stepSlaveInstanceStopped(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.stopComputerPartition()
def stepSlaveInstanceStopComputerPartitionInstallation(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.stopComputerPartitionInstallation()
def stepSetDeliveryLineAmountEqualZero(self, sequence):
sequence.edit(delivery_line_amount=0)
def stepSetDeliveryLineAmountEqualTwo(self, sequence):
sequence.edit(delivery_line_amount=2)
def stepSetDeliveryLineAmountEqualThree(self, sequence):
sequence.edit(delivery_line_amount=3)
def stepSetDeliveryLineAmountEqualOne(self, sequence):
sequence.edit(delivery_line_amount=1)
def test_Computer_getSoftwareReleaseList_twoPurchasePackingList(self):
"""
Check that calling Computer.getSoftwareReleaseList uses the
Purchase Packing List in proper state, regardless its date
"""
sequence_list = SequenceList()
sequence_string = self.prepare_two_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
LoginDefaultUser \
StepPurchasePackingListBStartDateAfterPurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
LoginDefaultUser \
StepPurchasePackingListBStartDateBeforePurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Computer_getSoftwareReleaseList_twoActivePurchasePackingList(self):
"""
Check that getSoftwareReleaseList only returns 1 software release if it is
associated to 2 purchase packing list.
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
Tic \
CreatePurchasePackingList \
Tic \
CreatePurchasePackingListLine \
Tic \
SetPurchasePackingListLineSetupResource \
SetPurchasePackingListLineAggregate \
ConfirmPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerGetSoftwareReleaseList))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionAvailable(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.available
########################################
def test_ComputerPartition_available_afterRegister(self):
"""
Check that calling ComputerPartition.available after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + """
SlapLoginCurrentComputer
CheckNotFoundComputerPartitionAvailableAfterRegisterCall
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_available_successConfirmed(self):
"""
Check that calling ComputerPartition.available change the sale packing
list state to stopped.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_available_alreadyStartedSalePackingList(self):
"""
Check that calling ComputerPartition.available more then once can be called
without error and changes nothing
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListStopped
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionAvailable))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionBuilding(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.building
########################################
def test_ComputerPartition_building_afterRegister(self):
"""
Check that calling ComputerPartition.building after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckNotFoundComputerPartitionBuildingAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_building_success(self):
"""
Check that calling ComputerPartition.building change the sale packing
list state to started.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_building_alreadyConfirmedSalePackingList(self):
"""
Check that calling ComputerPartition.building failed if there is already
confirmed sale packing list
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + """
SlapLoginCurrentComputer
SoftwareInstanceBuilding
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionBuilding))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionConnection(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.getConnectionParameter
# ComputerPartition.setConnectionDict
########################################
def test_ComputerPartition_Connection(self):
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibDeveloper
SelectNewSoftwareReleaseUri
CreateSoftwareRelease
Tic
SubmitSoftwareRelease
Tic
CreateSoftwareProduct
Tic
ValidateSoftwareProduct
Tic
SetSoftwareProductToSoftwareRelease
PublishByActionSoftwareRelease
Logout
LoginTestVifibAdmin
CreateComputer
Tic
Logout
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckGetSetConnectionDict
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionConnection))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.error
########################################
def test_ComputerPartition_error_afterRegister(self):
"""
Check that calling ComputerPartition.error after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateComputer \
Tic \
Logout \
SlapLoginCurrentComputer \
FormatComputer \
Tic \
SlapLogout \
Tic \
SlapLoginCurrentComputer \
CheckNotFoundComputerPartitionErrorAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_SetupResource_CancelledState(self):
"""
Check that calling ComputerPartition.error works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_SetupResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.error works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_SetupResource_StartedState(self):
"""
Check that calling ComputerPartition.error works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_SetupResource_StoppedState(self):
"""
Check that calling ComputerPartition.error works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_SetupResource_DeliveredState(self):
"""
Check that calling ComputerPartition.error works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
LoginDefaultUser \
DeliverSalePackingList \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListDelivered \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_HostingResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.error works in
confirmed state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_HostingResource_StartedState(self):
"""
Check that calling ComputerPartition.error works in
started state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_HostingResource_StoppedState(self):
"""
Check that calling ComputerPartition.error works in
stopped state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stop_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_HostingResource_DeliveredState(self):
"""
Check that calling ComputerPartition.error works in
delivered state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_HostingResource_CancelledState(self):
"""
Check that calling ComputerPartition.error works in
cancelled state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_CleanupResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.error works in
confirmed state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListErrorText \
CheckConfirmedSalePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_CleanupResource_CancelledState(self):
"""
Check that calling ComputerPartition.error works in
cancelled state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\
LoginDefaultUser \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceCleanupSalePackingListCancelled \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
SlapLogout \
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_CleanupResource_StartedState(self):
"""
Check that calling ComputerPartition.error works in
started state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\
LoginDefaultUser \
StartSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListErrorText \
CheckStartedSalePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_CleanupResource_StoppedState(self):
"""
Check that calling ComputerPartition.error works in
stopped state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\
LoginDefaultUser \
StartSalePackingList \
StopSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListErrorText \
CheckStoppedSalePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_CleanupResource_DeliveredState(self):
"""
Check that calling ComputerPartition.error works in
delivered state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\
LoginDefaultUser \
StartSalePackingList \
StopSalePackingList \
DeliverSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundComputerPartitionErrorCall \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
CheckDeliveredSalePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_AccountingResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.error works in
confirmed state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_AccountingResource_CancelledState(self):
"""
Check that calling ComputerPartition.error works in
cancelled state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
CheckCancelledSalePackingList \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_AccountingResource_StartedState(self):
"""
Check that calling ComputerPartition.error works in
started state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
StartSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
CheckStartedSalePackingList \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_AccountingResource_StoppedState(self):
"""
Check that calling ComputerPartition.error works in
stopped state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
StartSalePackingList \
StopSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
CheckStoppedSalePackingList \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_AccountingResource_DeliveredState(self):
"""
Check that calling ComputerPartition.error works in
delivered state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
StartSalePackingList \
StopSalePackingList \
DeliverSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
CheckDeliveredSalePackingList \
SelectCurrentlyUsedSalePackingListUid \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_error_twoSalePackingList(self):
"""
Check that calling ComputerPartition.error uses the latest sale packing
list for calculation
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SetHostingAfterSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
LoginDefaultUser \
CheckSalePackingListNoErrorText \
SetHostingBeforeSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckSalePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionError))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionGetInstanceParameterDict(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.getInstanceParameterDict
########################################
def test_ComputerPartition_getInstanceParameterDict_afterRegister(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict after just
registration works
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetInstanceParameterDictCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_confirmedState(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict works in
confirmed state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
CheckSuccessComputerPartitionGetInstanceParameterDictCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_cancelledState(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict works in
cancelled state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentSoftwareInstance \
CheckSuccessComputerPartitionGetInstanceParameterDictCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_startedState(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict works in
started state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
CheckSuccessComputerPartitionGetInstanceParameterDictCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_stoppedState(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict works in
stopped state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
CheckSuccessComputerPartitionGetInstanceParameterDictCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_emptyParameter(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict does
return minimal information in case no parameters are set
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
CheckMinimalParametersTransmitted \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getInstanceParameterDict_validXML(self):
"""
Check that calling ComputerPartition.getInstanceParameterDict works
if the XML doesn't respect the XSD
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SetSoftwareInstanceValidXML \
Tic \
Logout \
SlapLoginCurrentSoftwareInstance \
CheckComputerPartitionGetInstanceParameterDictResult \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionGetInstanceParameterDict))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionGetSoftwareRelease(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.getSoftwareRelease
########################################
def test_ComputerPartition_getSoftwareRelease_afterRegister(self):
"""
Check that calling ComputerPartition.getSoftwareRelease after just
registration raises a NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckNotFoundComputerPartitionGetSoftwareReleaseAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getSoftwareRelease_confirmedState(self):
"""
Check that calling ComputerPartition.getSoftwareRelease works in
confirmed state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getSoftwareRelease_cancelledState(self):
"""
Check that calling ComputerPartition.getSoftwareRelease works in
cancelled state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getSoftwareRelease_startedState(self):
"""
Check that calling ComputerPartition.getSoftwareRelease works in
started state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getSoftwareRelease_stoppedState(self):
"""
Check that calling ComputerPartition.getSoftwareRelease works in
stopped state
"""
sequence_list = SequenceList()
sequence_string = self.prepare_installed_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getSoftwareRelease_twoSalePackingList(self):
"""
Check that calling ComputerPartition.getSoftwareRelease """
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
LoginDefaultUser \
CheckPackingListAmountTwoComputerPartition \
SetHostingAfterSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessComputerPartitionGetSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionGetSoftwareRelease))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.getState
########################################
def test_ComputerPartition_getState_emptyPartition(self):
"""
Check that calling ComputerPartition.getState after just
registration raises a NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_SetupResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.getState works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_SetupResource_CancelledState(self):
"""
Check that calling ComputerPartition.getState works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_SetupResource_StartedState(self):
"""
Check that calling ComputerPartition.getState works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_building_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_SetupResource_StoppedState(self):
"""
Check that calling ComputerPartition.getState works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_SetupResource_DeliveredState(self):
"""
Check that calling ComputerPartition.getState works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
StartSalePackingList \
StopSalePackingList \
DeliverSalePackingList \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListDelivered \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
CheckComputerPartitionInstanceHostingSalePackingListCancelled \
CheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists \
Logout \
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_HostingResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.getState works in
confirmed state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_HostingResource_CancelledState(self):
"""
Check that calling ComputerPartition.getState works in
cancelled state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_start_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_HostingResource_StartedState(self):
"""
Check that calling ComputerPartition.getState works in
started state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_HostingResource_StoppedState(self):
"""
Check that calling ComputerPartition.getState works in
stopped state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stop_requested_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_HostingResource_DeliveredState(self):
"""
Check that calling ComputerPartition.getState works in
delivered state with the hosting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string + '\
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_CleanupResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.getState works in
confirmed state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_CleanupResource_CancelledState(self):
"""
Check that calling ComputerPartition.getState works in
cancelled state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
CancelSalePackingList \
Logout \
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_CleanupResource_StartedState(self):
"""
Check that calling ComputerPartition.getState works in
started state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
StartSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_CleanupResource_StoppedState(self):
"""
Check that calling ComputerPartition.getState works in
stopped state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_destroy_requested_computer_partition + '\
LoginDefaultUser \
SelectCurrentlyUsedSalePackingListUid \
StartSalePackingList \
StopSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_CleanupResource_DeliveredState(self):
"""
Check that calling ComputerPartition.getState works in
delivered state with the cleanup resource
"""
sequence_list = SequenceList()
sequence_string = self\
.prepare_destroyed_computer_partition + '\
SlapLoginCurrentComputer \
CheckDestroyedComputerPartitionGetStateCall \
SlapLoginCurrentComputer \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_AccountingResource_ConfirmedState(self):
"""
Check that calling ComputerPartition.getState works in
confirmed state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_AccountingResource_CancelledState(self):
"""
Check that calling ComputerPartition.getState works in
cancelled state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\
LoginDefaultUser \
CancelSalePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_AccountingResource_StartedState(self):
"""
Check that calling ComputerPartition.getState works in
started state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_started_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_AccountingResource_StoppedState(self):
"""
Check that calling ComputerPartition.getState works in
stopped state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_stopped_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_AccountingResource_DeliveredState(self):
"""
Check that calling ComputerPartition.getState works in
delivered state with the accounting resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer_partition_accounting_resource_delivered_sequence_string + '\
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_getState_twoSalePackingList(self):
"""
Check that calling ComputerPartition.getState uses the latest sale packing
list for calculation
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + '\
LoginDefaultUser \
CheckPackingListAmountTwoComputerPartition \
SetHostingBeforeSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStoppedComputerPartitionGetStateCall \
SlapLogout \
LoginDefaultUser \
SetHostingAfterSetupStartDate \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckStartedComputerPartitionGetStateCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionGetState))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
########################################
# ComputerPartition.request
########################################
def test_ComputerPartition_request_noFreePartition(self):
"""
Check that first call to request raises NotReady response
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotFoundResponse \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_firstNotReady(self):
"""
Check that first call to request raises NotReady response
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# XXX: This test fails because test_vifib_customer security is cached
# and this user is not in SOFTINST-x group. We do not want to clear
# cache in tests.
@expectedFailure
def test_ComputerPartition_request_noParameterInRequest(self):
"""
Check that it is possible to request another Computer Partition
from existing one, without passing any parameters and that in such case
original's Sofware Instance parameters will be passed.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
SlapLogout \
\
LoginTestVifibCustomer \
CheckViewCurrentSoftwareInstance \
CheckWriteCurrentSoftwareInstance \
Tic \
CheckViewRequestedSoftwareInstance \
CheckWriteRequestedSoftwareInstance \
Tic \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetCurrentSoftwareInstanceRequested(self, sequence):
sequence.edit(
requester_software_instance_uid=sequence['software_instance_uid'],
software_instance_uid=sequence['requested_software_instance_uid'],
)
def stepSetCurrentSoftwareInstanceRequester(self, sequence):
sequence.edit(
software_instance_uid=sequence['requester_software_instance_uid']
)
def test_ComputerPartition_request_instantiate(self):
"""
Check that after computer partition is requested it is possible to
instantiate it and it is started correctly.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
Logout \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceBuilding \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStopped \
CheckComputerPartitionInstanceHostingSalePackingListConfirmed \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetInstanceStateStopped(self, sequence=None, **kw):
sequence['instance_state'] = 'stopped'
def test_ComputerPartition_request_instantiate_state_stopped(self):
"""
Check that after computer partition is requested it is possible to
instantiate it and it is stopped correctly, as requested initally.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SetInstanceStateStopped \
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
Logout \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceBuilding \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStopped \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStopped \
Tic \
SlapLogout \
\
LoginDefaultUser \
stepCheckComputerPartitionNoInstanceHostingSalePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_instantiate_stop_later(self):
"""
Check that after computer partition is requested it is possible to
instantiate it and it is started correctly, and later it is stopped
correctly as requested.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
Logout \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceBuilding \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStopped \
CheckComputerPartitionInstanceHostingSalePackingListConfirmed \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
\
SetInstanceStateStopped \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequester \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
Logout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
CheckComputerPartitionInstanceHostingSalePackingListStopped \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStopped \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListDelivered \
Logout \
\
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_state_is_optional(self):
"""Checks that state is optional parameter on Slap Tool
This ensures backward compatibility with old libraries."""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
DirectRequestComputerPartitionNotReadyResponseWithoutState \
Tic \
SlapLogout \
\
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# XXX: This test fails because test_vifib_customer security is cached
# and this user is not in SOFTINST-x group. We do not want to clear
# cache in tests.
@expectedFailure
def test_ComputerPartition_request_instantiateStop(self):
"""
Check that after computer partition is requested it is possible to
instantiate it and stop.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
Logout \
\
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
SelectCurrentlyUsedSalePackingListUid \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceBuilding \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStarted \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStopped \
CheckComputerPartitionInstanceHostingSalePackingListConfirmed \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
\
LoginTestVifibCustomer \
RequestSoftwareInstanceStop \
Tic \
Logout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListStopped \
Logout \
\
SlapLoginCurrentComputer \
SoftwareInstanceStopped \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListDelivered \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_parameterInRequest(self):
"""
Check that it is possible to request another Computer Partition
from existing one, with passing parameters and that in such case all
passed parameters are available on new Computer Partition and no
parameters are copied.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SelectRequestedReference \
SelectRequestedParameterDictRequestedParameter \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionRequestedParameter \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_twiceSameSourceSameResult(self):
"""
Checks that requesting twice with same arguments from same Computer Partition
will return same object."""
self.computer_partition_amount = 3
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SelectRequestedReference \
SelectEmptyRequestedParameterDict \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
\
SlapLoginCurrentSoftwareInstance \
CheckRequestedComputerPartitionCleanParameterList \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_twiceDifferentParent(self):
"""
Checks that requesting twice with same arguments from different Computer
Partition will return same object.
This test is reproducing scenario:
Master
/ \
ChildrenA ChildrenB
\
ChildrenRequestedTwice
Then ChildrenB requests ChildrenRequestedTwice, so graph changes to:
Master
/ \
ChildrenA ChildrenB
/
ChildrenRequestedTwice
"""
self.computer_partition_amount = 4
sequence_list = SequenceList()
sequence_string = self.prepare_children_a_children_b_sequence_string + """
# Generate first part of graph
# Master
# / \
# ChildrenA ChildrenB
# \
# ChildrenRequestedTwice
LoginDefaultUser
SetSoftwareInstanceChildrenA
SelectRequestedReference
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
Tic
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetRequestedComputerPartition
CheckComputerPartitionChildrenA
CheckComputerPartitionChildrenBNoChild
CheckComputerPartitionRequestedDoubleScenarioChildrenA
Logout
# Generate second part of graph
# Master
# / \
# ChildrenA ChildrenB
# /
# ChildrenRequestedTwice
LoginDefaultUser
SetRequestedComputerPartition
SetSoftwareInstanceChildrenB
SelectRequestedReference
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
Tic
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetRequestedComputerPartition
CheckComputerPartitionChildrenANoChild
CheckComputerPartitionChildrenB
CheckComputerPartitionRequestedDoubleScenarioChildrenB
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# Marked as expectedFailure as implementation is not ready yet
@expectedFailure
def test_ComputerPartition_request_twiceDifferentParentWithoutTic(self):
"""
Checks that requesting twice with same arguments from different Computer
Partition will return same object.
This test is reproducing scenario:
Master
/ \
ChildrenA ChildrenB
\
ChildrenRequestedTwice
Then ChildrenB requests ChildrenRequestedTwice, so graph changes to:
Master
/ \
ChildrenA ChildrenB
/
ChildrenRequestedTwice
Case without tic between requests.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_children_a_children_b_sequence_string + """
SelectRequestedReference
SelectEmptyRequestedParameterDict
SetSoftwareInstanceChildrenA
RequestComputerPartitionNotReadyResponse
SetSoftwareInstanceChildrenB
RequestComputerPartitionNotReadyResponse
Tic
SetSoftwareInstanceChildrenA
RequestComputerPartition
Tic
SetSoftwareInstanceChildrenB
RequestComputerPartition
Tic
SetRequestedComputerPartition
CheckComputerPartitionChildrenA
CheckComputerPartitionChildrenB
CheckComputerPartitionRequestedDoubleScenario
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_differentSourceDifferentResultWithTic(self):
"""
Check that requesting different Computer Partitions from different sources
gives different result, because they are requesting different
partition_reference.
This test is reproducing scenario:
Master
/ \
ChildrenA ChildrenB
| |
ChildChildA ChildChildB
"""
self.computer_partition_amount = 5
sequence_list = SequenceList()
sequence_string = self.prepare_children_a_children_b_sequence_string + """
# Request ChildChildrenA
LoginDefaultUser
SetSoftwareInstanceChildrenA
SelectRequestedReferenceChildrenAChild
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
Tic
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetChildrenAChildComputerPartition
# Request ChilChildrenB
SetSoftwareInstanceChildrenB
SelectRequestedReferenceChildrenBChild
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
Tic
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetChildrenBChildComputerPartition
# Do assertions
CheckComputerPartitionChildrenAWithOwnChildren
CheckComputerPartitionChildrenBWithOwnChildren
CheckComputerPartitionChildrenAChild
CheckComputerPartitionChildrenBChild
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# Marked as expectedFailure as implementation is not ready yet
@expectedFailure
def test_ComputerPartition_request_differentSourceDifferentResultWithoutTic(
self):
"""
Check that requesting different Computer Partitions from different sources
gives different result, because they are requesting different
partition_reference.
This test is reproducing scenario:
Master
/ \
ChildrenA ChildrenB
| |
ChilChildA ChildChildB
Case without tic between requests.
"""
self.computer_partition_amount = 5
sequence_list = SequenceList()
sequence_string = self.prepare_children_a_children_b_sequence_string + """
LoginDefaultUser
SetSoftwareInstanceChildrenA
SelectRequestedReferenceChildrenAChild
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetChildrenAChildComputerPartition
SetSoftwareInstanceChildrenB
SelectRequestedReferenceChildrenBChild
SelectEmptyRequestedParameterDict
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotReadyResponse
RequestComputerPartition
Tic
SlapLogout
LoginDefaultUser
SetChildrenBChildComputerPartition
CheckComputerPartitionChildrenAWithOwnChildren
CheckComputerPartitionChildrenBWithOwnChildren
CheckComputerPartitionChildrenAChild
CheckComputerPartitionChildrenBChild
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_serialiseIsCalled(self):
"""
Check that during ComputerPartition.request serialise is being called
on being choosen Computer Partition.
Serialize call is used to protect Computer Partition from being selected
as free in case of concurrency connections.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SelectRequestedReferenceChildrenA \
SelectEmptyRequestedParameterDict \
RequestComputerComputerPartitionCheckSerializeCalledOnSelected \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
########################################
# ComputerPartition.request - filter - computer_guid
########################################
def stepStoreComputerReference(self, sequence):
sequence['original_computer_reference'] = sequence['computer_reference']
def stepRestoreComputerReference(self, sequence):
sequence['computer_reference'] = sequence['original_computer_reference']
def stepSetRequestedFilterParameterDict(self, sequence):
sequence['requested_filter_dict'] = dict(
computer_guid=sequence['computer_reference'])
def test_ComputerPartition_request_filter_computer_guid(self):
"""
Check that requesting with filter computer_guid key works as expected
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
# There are two partitions on another computer
# so request shall be processed twice correctly, 3rd time it shall
# fail
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + \
self.prepare_another_computer_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
SelectAnotherRequestedReference \
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
SlapLogout \
\
SelectYetAnotherRequestedReference \
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotFoundResponse \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
########################################
# ComputerPartition.request - slave
########################################
def test_ComputerPartition_request_slave_firstNotReady(self):
"""
Check that first call to request raises NotReadyResponse
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
SelectEmptyRequestedParameterDict \
SetRandomRequestedReference \
RequestSlaveInstanceFromComputerPartitionNotReadyResponse \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_simpleCase(self):
"""
Check the most simple case of request. The behaviour should
keep the same as Software Instance.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string +\
"""
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict \
SetRandomRequestedReference \
RequestSlaveInstanceFromComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_instantiate(self):
"""
Check that one Slave Instance is instantiate correctly and the validate
the Sale Packing List states
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string +\
"""
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SetRandomRequestedReference
RequestSlaveInstanceFromComputerPartitionNotReadyResponse
Tic
SlapLogout
SlapLoginCurrentSoftwareInstance
RequestSlaveInstanceFromComputerPartition
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentSoftwareInstance
CheckSlaveInstanceListFromOneComputerPartition
SelectSlaveInstanceFromOneComputerPartition
SlapLogout
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser \
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
Logout
SlapLoginCurrentComputer \
SoftwareInstanceStarted \
Tic \
SlapLogout \
\
LoginDefaultUser \
CheckComputerPartitionInstanceHostingSalePackingListStarted \
Logout \
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_same_twice_SR(self):
"""
Check that requesting the same slave instance twice, only one is created
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string +\
"""
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SelectRequestedReference
RequestSlaveInstanceFromComputerPartitionNotReadyResponse
Tic
SlapLogout
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartition \
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartition \
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_after_destroy_SlaveInstance(self):
"""
Check that a Slave Instance will not be allocated when a Software
Instance is destroyed
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLogout
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SelectRequestedReference
RequestSlaveInstanceFromComputerPartitionNotFoundError
Tic
RequestSlaveInstanceFromComputerPartitionNotFoundError
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_twice_different(self):
"""
Check request 2 different slave instances on same Software
Instance.
"""
simple_request_with_random = """
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict \
SetRandomRequestedReference \
RequestSlaveInstanceFromComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string +\
simple_request_with_random + """
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
""" + \
simple_request_with_random + \
"""
SlapLoginCurrentComputer
CheckTwoSlaveInstanceListFromOneComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_NotFound(self):
"""
Check that requesting a Slave Instance works in system capable to fulfill
such request, when Software Instance is not installed yet.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + """
LoginDefaultUser
SetRandomComputerPartition
SlapLoginCurrentComputer
SelectEmptyRequestedParameterDict
SetRandomRequestedReference
SelectNewSoftwareReleaseUri
RequestSlaveInstanceFromComputerPartitionNotFoundError
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_ComputerPartition_request_slave_state_is_optional(self):
"""Checks that state is optional parameter on Slap Tool This ensures
backward compatibility with old libraries."""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
DirectRequestComputerPartitionNotReadyResponseWithoutStateAndSharedTrue \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetRequestedWrongFilterParameterDict(self, sequence):
sequence['requested_filter_dict'] = dict(
computer_guid="COMP-99999999999999999999999")
def test_ComputerPartition_request_filter_slave_computer_guid(self):
"""Check that requesting with filter computer_guid key works as expected.
This include tests for slave instance case."""
self.computer_partition_amount = 2
sequence_list = SequenceList()
# There are two partitions on another computer
# so request shall be processed twice correctly, 3rd time it shall
# fail
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + \
self.prepare_another_computer_sequence_string + '\
SelectAnotherRequestedReference \
SelectEmptyRequestedParameterDict \
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartitionNotFoundError \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
SetRequestedFilterParameterDict \
RequestSlaveInstanceFromComputerPartitionNotReadyResponse \
Tic \
SlapLogout \
\
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout \
\
SetRequestedWrongFilterParameterDict \
SelectYetAnotherRequestedReference \
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartitionNotFoundError \
Tic \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionRequest))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin):
########################################
# slap.registerComputer
########################################
def test_slap_registerComputer_unknowComputerUid(self):
"""
Check the slap.registerComputer without any Computer document
does not fail
"""
sequence_list = SequenceList()
sequence_string = '\
SetRandomComputerReference \
LoginDefaultUser \
CheckSuccessSlapRegisterComputerCall \
Logout \
Tic \
LoginDefaultUser \
CheckUnexistingComputer \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputer_draftComputer(self):
"""
Check the slap.registerComputer does not fail if
a draft computer exits.
"""
sequence_list = SequenceList()
# Note: ERP5TypeTestCase is used as login to being able to test it
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout \
\
LoginDefaultUser \
CheckSuccessSlapRegisterComputerCall \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputer_validatedComputer(self):
"""
Check the slap.registerComputer does not fail if
a validated computer exists.
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer\
CheckSuccessSlapRegisterComputerCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputer_TwoValidatedComputer(self):
"""
Check the slap.registerComputer works in case of more then one computer available
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateComputer \
Tic \
Logout \
\
LoginTestVifibAdmin \
CreateComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer\
CheckSuccessSlapRegisterComputerCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapRegisterComputer))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapRegisterComputerPartition(TestVifibSlapWebServiceMixin):
########################################
# slap.registerComputerPartition
########################################
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_slap_registerComputerPartition_unknowComputerUid(self):
"""
Check the slap.registerComputerPartition without any Computer document
fails.
"""
sequence_list = SequenceList()
sequence_string = '\
SlapLoginRandomComputer \
CheckUnauthorizedSlapRegisterComputerPartitionCall \
SlapLogout \
Tic \
CheckUnexistingComputer \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ERP5/Zope does not follow REST API beacuse it is not possible to configure
# Cookie Crumbler to ignore portal_slap
@expectedFailure
def test_slap_registerComputerPartition_draftComputer(self):
"""
Check the slap.registerComputerPartition fails
"""
sequence_list = SequenceList()
sequence_string = '\
LoginTestVifibAdmin \
CreateDraftComputer \
Tic \
Logout \
\
SlapLoginCurrentComputer \
CheckUnauthorizedSlapRegisterComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputerPartition_ComputerWithoutPartition(self):
"""
Check the slap.registerComputerPartition fails
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
SlapLoginCurrentComputer\
CheckNotFoundSlapRegisterComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputerPartition_ComputerWithPartition(self):
"""
Check the slap.registerComputerPartition works
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputerPartition_TwoValidatedComputer(self):
"""
Check the slap.registerComputerPartition works
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerComputerPartition_ComputerWithTwoPartition(self):
"""
Check the slap.registerComputerPartition fails if there are 2 partition
with the same reference.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterComputerPartitionCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapRegisterComputerPartition))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapRegisterSoftwareRelease(TestVifibSlapWebServiceMixin):
########################################
# slap.registerSoftwareRelease
########################################
def test_slap_registerSoftwareRelease_validatedSoftwareRelease(self):
"""
Check the slap.registerSoftwareRelease does not fail if
a validated computer exists.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
LoginTestVifibAdmin \
CreateComputer \
Tic \
Logout \
\
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
SubmitSoftwareRelease \
Tic \
CreateSoftwareProduct \
Tic \
ValidateSoftwareProduct \
Tic \
SetSoftwareProductToSoftwareRelease \
PublishByActionSoftwareRelease \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerSoftwareRelease_unknowSoftwareReleaseUid(self):
"""
Check the slap.registerSoftwareRelease without any SoftwareRelease document
does not fail
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
SelectNewSoftwareReleaseUri \
\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerSoftwareRelease_draftSoftwareRelease(self):
"""
Check the slap.registerSoftwareRelease does not fail if
a draft computer exits.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_slap_registerSoftwareRelease_TwoValidatedSoftwareRelease(self):
"""
Check the slap.registerSoftwareRelease works
"""
sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
SubmitSoftwareRelease \
Tic \
CreateSoftwareProduct \
Tic \
ValidateSoftwareProduct \
Tic \
SetSoftwareProductToSoftwareRelease \
PublishByActionSoftwareRelease \
Logout \
\
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
SubmitSoftwareRelease \
Tic \
CreateSoftwareProduct \
Tic \
ValidateSoftwareProduct \
Tic \
SetSoftwareProductToSoftwareRelease \
PublishByActionSoftwareRelease \
Logout \
\
SlapLoginCurrentComputer \
CheckSuccessSlapRegisterSoftwareReleaseCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapRegisterSoftwareRelease))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapSoftwareReleaseAvailable(TestVifibSlapWebServiceMixin):
########################################
# SoftwareRelease.available
########################################
def test_SoftwareRelease_available_afterRegister(self):
"""
Check that calling SoftwareRelease.available after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
SelectNewSoftwareReleaseUri \
CheckNotFoundSoftwareReleaseAvailableAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_SetupResource_ConfirmedState(self):
"""
Check that calling SoftwareRelease.available works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_SetupResource_CancelledState(self):
"""
Check that calling SoftwareRelease.available works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckCancelledPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_SetupResource_StartedState(self):
"""
Check that calling SoftwareRelease.available works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_SetupResource_StoppedState(self):
"""
Check that calling SoftwareRelease.available works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_SetupResource_DeliveredState(self):
"""
Check that calling SoftwareRelease.available works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_twoPurchasePackingList(self):
"""
Check that calling SoftwareRelease.available uses the latest purchase packing
list for calculation
"""
sequence_list = SequenceList()
sequence_string = self.prepare_two_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateAfterPurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingListB \
Logout'
sequence_list.addSequenceString(sequence_string)
sequence_string = self.prepare_two_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateBeforePurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingListB \
Logout'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapSoftwareReleaseAvailable))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapSoftwareReleaseBuilding(TestVifibSlapWebServiceMixin):
########################################
# SoftwareRelease.building
########################################
def test_SoftwareRelease_building_afterRegister(self):
"""
Check that calling SoftwareRelease.building after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SelectNewSoftwareReleaseUri \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseBuildingAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_SetupResource_ConfirmedState(self):
"""
Check that calling SoftwareRelease.building works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStartedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_SetupResource_CancelledState(self):
"""
Check that calling SoftwareRelease.building works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseBuildingCall \
SlapLogout \
LoginDefaultUser \
CheckCancelledPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_SetupResource_StartedState(self):
"""
Check that calling SoftwareRelease.building works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStartedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_SetupResource_StoppedState(self):
"""
Check that calling SoftwareRelease.building works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_SetupResource_DeliveredState(self):
"""
Check that calling SoftwareRelease.building works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_building_twoPurchasePackingList(self):
"""
Check that calling SoftwareRelease.building uses the Purchase Packing List
in proper state, regardless its date
"""
sequence_list = SequenceList()
sequence_string = self.prepare_two_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateAfterPurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStartedPurchasePackingListB \
Logout'
sequence_list.addSequenceString(sequence_string)
sequence_string = self.prepare_two_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateBeforePurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseBuildingCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStartedPurchasePackingListB \
Logout'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapSoftwareReleaseBuilding))
return suite
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from VifibMixin import testVifibMixin
from random import random
from slapos import slap
import urllib
import urlparse
import httplib
from xml_marshaller import xml_marshaller
import transaction
import unittest
class TestVifibSlapSoftwareReleaseError(TestVifibSlapWebServiceMixin):
########################################
# SoftwareRelease.error
########################################
def test_SoftwareRelease_error_afterRegister(self):
"""
Check that calling SoftwareRelease.error after just registration raises a
NotFoundError
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
SelectNewSoftwareReleaseUri \
CheckNotFoundSoftwareReleaseErrorAfterRegisterCall \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_SetupResource_ConfirmedState(self):
"""
Check that calling SoftwareRelease.error works in
confirmed state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListErrorText \
CheckConfirmedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_SetupResource_CancelledState(self):
"""
Check that calling SoftwareRelease.error works in
cancelled state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListNoErrorText \
CheckCancelledPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_SetupResource_StartedState(self):
"""
Check that calling SoftwareRelease.error works in
started state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListErrorText \
CheckStartedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_SetupResource_StoppedState(self):
"""
Check that calling SoftwareRelease.error works in
stopped state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListNoErrorText \
CheckStoppedPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_SetupResource_DeliveredState(self):
"""
Check that calling SoftwareRelease.error works in
delivered state with the setup resource
"""
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListNoErrorText \
CheckDeliveredPurchasePackingList \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_error_twoPurchasePackingList(self):
"""
Check that calling SoftwareRelease.error uses the latest purchase packing
list for calculation
"""
sequence_list = SequenceList()
sequence_string = self.prepare_two_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
LoginDefaultUser \
StepPurchasePackingListBStartDateAfterPurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_string = self.prepare_two_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessComputerGetSoftwareReleaseListCall \
SlapLogout \
LoginDefaultUser \
StepPurchasePackingListBStartDateBeforePurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseErrorCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckPurchasePackingListErrorText \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapSoftwareReleaseError))
return suite
This source diff could not be displayed because it is too large. You can view the blob instead.
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