Commit 93870f81 authored by Romain Courteaud's avatar Romain Courteaud

Fix f9006416

parent 3bc7a5ec
......@@ -14,6 +14,7 @@ import xml.dom.ext
import StringIO
import difflib
import transaction
from OFS.Traversable import NotFound
class Simulator:
def __init__(self, outfile, method):
......@@ -542,6 +543,29 @@ class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
if os.path.exists(self.computer_load_configuration_simulator):
os.unlink(self.computer_load_configuration_simulator)
def test_destroyedSoftwareRelease_noSoftwareInstallation(self):
self.login(self.computer_id)
self.assertRaises(NotFound,
self.portal_slap.destroyedSoftwareRelease,
"http://example.org/foo", self.computer_id)
def test_destroyedSoftwareRelease_noDestroyRequested(self):
self._makeComplexComputer()
self.login(self.computer_id)
self.assertRaises(NotFound,
self.portal_slap.destroyedSoftwareRelease,
self.start_requested_software_installation.getUrlString(),
self.computer_id)
def test_destroyedSoftwareRelease_destroyRequested(self):
self._makeComplexComputer()
self.login(self.computer_id)
destroy_requested = self.destroy_requested_software_installation
self.assertEquals(destroy_requested.getValidationState(), "validated")
self.portal_slap.destroyedSoftwareRelease(
destroy_requested.getUrlString(), self.computer_id)
self.assertEquals(destroy_requested.getValidationState(), "invalidated")
class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
def test_getComputerPartitionCertificate(self):
self._makeComplexComputer()
......
19
\ No newline at end of file
20
\ No newline at end of file
......@@ -857,9 +857,10 @@ class SlapTool(BaseTool):
computer_document)
if software_installation.getSlapState() != 'destroy_requested':
raise NotFound
if portal.portal_workflow.isTransitionPossible(software_installation,
if self.getPortalObject().portal_workflow.isTransitionPossible(software_installation,
'invalidate'):
software_installation.invalidate(comment=comment)
software_installation.invalidate(
comment="Software Release destroyed report.")
@convertToREST
def _buildingComputerPartition(self, computer_id, computer_partition_id):
......
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