Commit 8217636f authored by Łukasz Nowak's avatar Łukasz Nowak

Cover SoftwareRelease.destroyed call.

Cover different cases of having already setup packing list.
parent de1f7214
from Products.ERP5Type.tests.Sequence import SequenceList
import unittest
from testVifibSlapWebService import TestVifibSlapWebServiceMixin
class TestVifibSlapSoftwareReleaseDestroyed(TestVifibSlapWebServiceMixin):
########################################
# SoftwareRelease.destroyed
########################################
def test_SoftwareRelease_destroyed_afterRegister(self):
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + '\
SlapLoginCurrentComputer \
SelectNewSoftwareReleaseUri \
CheckNotFoundSoftwareReleaseDestroyedAfterRegisterCall \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_cleanup_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingList \
Logout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_ConfirmedState_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
SetCurrentPurchasePackingListAsA \
Logout ' + \
self.prepare_software_release_cleanup_confirmed_packing_list + '\
SetCurrentPurchasePackingListAsB \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_StartedState_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
SetCurrentPurchasePackingListAsA \
Logout' + \
self.prepare_software_release_cleanup_confirmed_packing_list + '\
SetCurrentPurchasePackingListAsB \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_StoppedState_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
SetCurrentPurchasePackingListAsA \
Logout' + \
self.prepare_software_release_cleanup_confirmed_packing_list + '\
SetCurrentPurchasePackingListAsB \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_DeliveredState_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
DeliverPurchasePackingList \
Tic \
SetCurrentPurchasePackingListAsA \
Logout' + \
self.prepare_software_release_cleanup_confirmed_packing_list + '\
SetCurrentPurchasePackingListAsB \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_CancelledState_CleanupResource_ConfirmedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
SetCurrentPurchasePackingListAsA \
Logout' + \
self.prepare_software_release_cleanup_confirmed_packing_list + '\
SetCurrentPurchasePackingListAsB \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
LoginDefaultUser \
CheckCancelledPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_CancelledState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckCancelledPurchasePackingList \
Logout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_CleanupResource_CancelledState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_cleanup_purchase_packing_list + '\
LoginDefaultUser \
CancelPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_available_CleanupResource_StartedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_cleanup_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingList \
Logout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_StartedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_CleanupResource_StoppedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_cleanup_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckStoppedPurchasePackingList \
Logout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_StoppedState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_CleanupResource_DeliveredState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_cleanup_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
StopPurchasePackingList \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingList \
Logout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_SetupResource_DeliveredState(self):
sequence_list = SequenceList()
sequence_string = self.prepare_software_release_purchase_packing_list + '\
LoginDefaultUser \
StartPurchasePackingList \
Tic \
StopPurchasePackingList \
Tic \
DeliverPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckNotFoundSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SoftwareRelease_destroyed_twoPurchasePackingList(self):
sequence_list = SequenceList()
sequence_string = self.prepare_two_cleanup_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateAfterPurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseDestroyedCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout\
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_string = self.prepare_two_cleanup_purchase_packing_list + '\
LoginDefaultUser \
StepPurchasePackingListBStartDateBeforePurchasePackingListA \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckSuccessSoftwareReleaseAvailableCall \
Tic \
SlapLogout \
LoginDefaultUser \
CheckDeliveredPurchasePackingListA \
CheckDeliveredPurchasePackingListB \
Logout\
LoginERP5TypeTestCase \
CheckSiteConsistency \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapSoftwareReleaseDestroyed))
return suite
...@@ -1354,6 +1354,24 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1354,6 +1354,24 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
CheckConfirmedPurchasePackingListB \ CheckConfirmedPurchasePackingListB \
Logout' Logout'
prepare_two_cleanup_purchase_packing_list = \
prepare_software_release_cleanup_purchase_packing_list + '\
LoginDefaultUser \
SetCurrentPurchasePackingListAsA \
StartPurchasePackingList \
StopPurchasePackingList \
Tic \
Logout \
SlapLoginCurrentComputer \
CheckEmptyComputerGetSoftwareReleaseListCall \
SlapLogout ' + \
prepare_software_release_cleanup_confirmed_packing_list + '\
LoginDefaultUser \
SetCurrentPurchasePackingListAsB \
CheckStoppedPurchasePackingListA \
CheckConfirmedPurchasePackingListB \
Logout'
prepare_another_computer_sequence_string = """ prepare_another_computer_sequence_string = """
StoreComputerReference StoreComputerReference
LoginTestVifibAdmin LoginTestVifibAdmin
...@@ -2536,6 +2554,16 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2536,6 +2554,16 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_release._computer_guid = computer_guid software_release._computer_guid = computer_guid
self.assertRaises(slap.NotFoundError, software_release.available) self.assertRaises(slap.NotFoundError, software_release.available)
def stepCheckNotFoundSoftwareReleaseDestroyedCall(self, sequence, **kw):
computer_guid = sequence["computer_reference"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(
sequence['software_release_uri'])
# Note: Hackish
software_release._computer_guid = computer_guid
self.assertRaises(slap.NotFoundError, software_release.destroyed)
def stepCheckTicAndNotFoundSoftwareReleaseAvailableCall(self, sequence, **kw): def stepCheckTicAndNotFoundSoftwareReleaseAvailableCall(self, sequence, **kw):
""" """
Check that calling SoftwareRelease.available raises NotFound Check that calling SoftwareRelease.available raises NotFound
...@@ -2594,6 +2622,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2594,6 +2622,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.assertRaises(slap.NotFoundError, software_release.error, "ErrorLog") self.assertRaises(slap.NotFoundError, software_release.error, "ErrorLog")
def stepCheckNotFoundSoftwareReleaseDestroyedAfterRegisterCall(self, sequence,
**kw):
url = sequence["software_release_uri"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url)
self.assertRaises(slap.NotFoundError, software_release.destroyed)
def stepCheckNotFoundSoftwareReleaseAvailableAfterRegisterCall(self, sequence, def stepCheckNotFoundSoftwareReleaseAvailableAfterRegisterCall(self, sequence,
**kw): **kw):
""" """
...@@ -2619,6 +2656,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2619,6 +2656,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_release.available() software_release.available()
def stepCheckSuccessSoftwareReleaseDestroyedCall(self, sequence, **kw):
computer_guid = sequence["computer_reference"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0]
software_release.destroyed()
def stepCheckUnauthorizedSoftwareReleaseAvailableCall(self, sequence, **kw): def stepCheckUnauthorizedSoftwareReleaseAvailableCall(self, sequence, **kw):
""" """
Check that calling SoftwareRelease.available is Unauthorized Check that calling SoftwareRelease.available is Unauthorized
...@@ -3757,6 +3803,16 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3757,6 +3803,16 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.portal.portal_catalog.getResultValue(uid=sequence[ self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid']).getSimulationState()) 'purchase_packing_list_b_uid']).getSimulationState())
def stepCheckDeliveredPurchasePackingListA(self, sequence):
self.assertEqual('delivered',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_a_uid']).getSimulationState())
def stepCheckDeliveredPurchasePackingListB(self, sequence):
self.assertEqual('delivered',
self.portal.portal_catalog.getResultValue(uid=sequence[
'purchase_packing_list_b_uid']).getSimulationState())
def stepCheckSlaveInstanceSecurityWithDifferentCustomer(self, sequence): def stepCheckSlaveInstanceSecurityWithDifferentCustomer(self, sequence):
software_instance_uid = sequence["software_instance_uid"] software_instance_uid = sequence["software_instance_uid"]
portal_membership = self.portal.portal_membership portal_membership = self.portal.portal_membership
......
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