From 5665b3740eb597dd7d25a9c2b7a29125b2236c1d Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 29 May 2012 17:09:08 +0200
Subject: [PATCH] requestUpdateComputerPartition has been removed

---
 .../testVifibSlapComputerPartitionUpdate.py   | 41 +++++++++++++++++--
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
index 1984daa03..601251835 100644
--- a/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
+++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py
@@ -6,8 +6,26 @@ from random import random
 
 class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
   def stepRequestSoftwareInstanceUpdate(self, sequence, **kw):
-    self.portal.portal_catalog.getResultValue(
-        uid=sequence['software_instance_uid']).requestUpdateComputerPartition()
+    instance = self.portal.portal_catalog.getResultValue(
+        uid=sequence['software_instance_uid'])
+    if instance.getPortalType() == "Software Instance":
+      shared = False
+    elif instance.getPortalType() == "Slave Instance":
+      shared = True
+    else:
+      raise NotImplementedError
+    method_dict = {
+        'start_requested': instance.requestStart,
+        'stop_requested': instance.requestStop,
+        'destroy_requested': instance.requestDestroy,
+        }
+    method_dict[instance.getSlapState()](
+        software_release=instance.getRootSoftwareReleaseUrl(),
+        instance_xml=instance.getTextContent(),
+        software_type=instance.getSourceReference(),
+        sla_xml=instance.getSlaXml(),
+        shared=shared,
+        )
 
   def stepCheckComputerPartitionInstanceUpdateSalePackingListDelivered(self,
       sequence, **kw):
@@ -463,7 +481,24 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
     **kw):
     instance = self.portal.portal_catalog.getResultValue(
         uid=sequence['software_instance_uid'])
-    self.assertRaises(ValidationFailed, instance.requestUpdateComputerPartition)
+    if instance.getPortalType() == "Software Instance":
+      shared = False
+    elif instance.getPortalType() == "Slave Instance":
+      shared = True
+    else:
+      raise NotImplementedError
+    method_dict = {
+        'start_requested': instance.requestStart,
+        'stop_requested': instance.requestStop,
+        'destroy_requested': instance.requestDestroy,
+        }
+    self.assertRaises(ValidationFailed, method_dict[instance.getSlapState()],
+        software_release=instance.getRootSoftwareReleaseUrl(),
+        instance_xml=instance.getTextContent(),
+        software_type=instance.getSourceReference(),
+        sla_xml=instance.getSlaXml(),
+        shared=shared,
+        )
 
   def test_update_not_possible_delivered_instance_cleanup(self):
     sequence_list = SequenceList()
-- 
2.30.9