From 43d67ce0e75ad9a5b92aeb30ed997c687fb93d1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 7 Jun 2011 12:09:20 +0200
Subject: [PATCH] Revert work which shall be done on branch.

---
 .../tests/testVifibSlapWebService.py          | 120 ++++++------------
 1 file changed, 42 insertions(+), 78 deletions(-)

diff --git a/master/product/VifibTest/tests/testVifibSlapWebService.py b/master/product/VifibTest/tests/testVifibSlapWebService.py
index 7a0cfcdf3..63a89a886 100644
--- a/master/product/VifibTest/tests/testVifibSlapWebService.py
+++ b/master/product/VifibTest/tests/testVifibSlapWebService.py
@@ -912,15 +912,6 @@ class TestVifibSlapWebService(testVifibMixin):
         uid=slave_partition_uid)
     slave_partition.markBusy()
 
-  def stepReplaceComputerPartitionBySlavePartition(self, sequence, **kw):
-    """
-      Use Slave Partition instead of Computer Partition
-    """
-    sequence["computer_partition_uid"] = sequence["slave_partition_uid"]
-    slave = self.portal.portal_catalog.getResultValue(uid=sequence["slave_partition_uid"])
-    sequence["computer_partition_reference"] = slave.getReference()
-    sequence["computer_partition_reference_list"].append(slave.getReference())
-
   def stepCreateSlavePartition(self, sequence, **kw):
     """
     Create a Slave Partition document.
@@ -953,12 +944,6 @@ class TestVifibSlapWebService(testVifibMixin):
     self.assertNotEqual(None, computer_partition_uid)
     sequence.edit(slave_owner_uid=computer_partition_uid)
 
-  def stepSelectNewComputerPartitionReference(self, sequence, **kw):
-    portal = self.getPortalObject()
-    computer = portal.portal_catalog.getResultValue(uid=sequence["computer_uid"])
-    reference = "slappart%s" % len(computer.objectValues())
-    sequence.edit(computer_partition_reference=reference)
-
   def stepCreateComputerPartition(self, sequence, **kw):
     """
     Create a computer partition document.
@@ -1217,16 +1202,15 @@ class TestVifibSlapWebService(testVifibMixin):
 
   def stepRequestSharedComputerPartition(self, sequence, **kw):
     software_release_uri = sequence['software_release_uri']
-    requested_parameter_dict = sequence.get('requested_parameter_dict', {})
+    requested_reference = sequence['requested_reference']
+    requested_parameter_dict = sequence['requested_parameter_dict']
     software_instance_uid = sequence['software_instance_uid']
-    portal_catalog = self.portal.portal_catalog
-    software_instance = portal_catalog.getResultValue(
+    software_instance = self.portal.portal_catalog.getResultValue(
         uid=software_instance_uid)
+
     computer_partition = software_instance.getAggregateRelatedValue(
         portal_type=self.sale_packing_list_line_portal_type).getAggregateValue(
-            portal_type=["Computer Partition", "Slave Partition"])
-    requested_reference = computer_partition.getReference()
-
+            portal_type=self.computer_partition_portal_type)
     computer = computer_partition
     while computer.getPortalType() != self.computer_portal_type:
       computer = computer.getParentValue()
@@ -1235,8 +1219,9 @@ class TestVifibSlapWebService(testVifibMixin):
     self.slap.initializeConnection(self.server_url)
     slap_computer_partition = self.slap.registerComputerPartition(
         computer.getReference(), computer_partition.getReference())
-    software_type = portal_catalog.getResultValue(uid=software_instance_uid).getTitle()
 
+    software_type = None
+    raise NotImplementedError('software_type not propagated')
     requested_slap_computer_partition = slap_computer_partition.request(
         software_release=software_release_uri, software_type=software_type,
         partition_reference=requested_reference,
@@ -1249,34 +1234,34 @@ class TestVifibSlapWebService(testVifibMixin):
 
   def stepRequestSharedComputerPartitionNotReadyResponse(self, sequence, **kw):
     software_release_uri = sequence['software_release_uri']
-    requested_parameter_dict = sequence.get('requested_parameter_dict', {})
+    requested_reference = sequence['requested_reference']
+    requested_parameter_dict = sequence['requested_parameter_dict']
     software_instance_uid = sequence['software_instance_uid']
-    portal_catalog = self.portal.portal_catalog
-    software_instance = portal_catalog.getResultValue(
+    software_instance = self.portal.portal_catalog.getResultValue(
         uid=software_instance_uid)
     computer_partition = software_instance.getAggregateRelatedValue(
         portal_type=self.sale_packing_list_line_portal_type).getAggregateValue(
-            portal_type=["Slave Partition","Computer Partition"])
-    requested_reference = computer_partition.getReference()
+            portal_type=self.computer_partition_portal_type)
     computer = computer_partition
     while computer.getPortalType() != self.computer_portal_type:
       computer = computer.getParentValue()
+
     self.slap = slap.slap()
     self.slap.initializeConnection(self.server_url)
     slap_computer_partition = self.slap.registerComputerPartition(
         computer.getReference(), computer_partition.getReference())
-    software_type = portal_catalog.getResultValue(uid=software_instance_uid).getTitle()
+    software_type = None
+    raise NotImplementedError('software_type not propagated')
     # first try will raise slap.ResourceNotReady
     self.assertRaises(slap.ResourceNotReady, slap_computer_partition.request,
       software_release=software_release_uri, software_type=software_type,
       partition_reference=requested_reference,
       partition_parameter_kw=requested_parameter_dict, shared=True)
-    sequence.edit(requested_reference=requested_reference)
 
   def stepRequestSharedComputerPartitionNotFoundResponse(self, sequence, **kw):
     software_release_uri = sequence['software_release_uri']
     requested_reference = sequence['requested_reference']
-    requested_parameter_dict = sequence.get('requested_parameter_dict', {})
+    requested_parameter_dict = sequence['requested_parameter_dict']
     software_instance_uid = sequence['software_instance_uid']
     software_instance = self.portal.portal_catalog.getResultValue(
         uid=software_instance_uid)
@@ -1293,9 +1278,9 @@ class TestVifibSlapWebService(testVifibMixin):
     slap_computer_partition = self.slap.registerComputerPartition(
         computer.getReference(), computer_partition.getReference())
     software_type = None
-    raise AtributeError("software_type is not propagated")
+    raise NotImplementedError('software_type not propagated')
     self.assertRaises(slap.NotFoundError, slap_computer_partition.request,
-      software_release=software_release_uri, software_type=software_type,
+      software_release=software_release_uri, sofware_type=software_type,
       partition_reference=requested_reference,
       partition_parameter_kw=requested_parameter_dict, shared=True)
 
@@ -2924,6 +2909,7 @@ class TestVifibSlapWebService(testVifibMixin):
         uid=software_instance_uid)
     # There should be only one predecessor
     self.assertEqual(1, len(software_instance.getPredecessorList()))
+
     self._checkSoftwareInstanceAndRelatedPartition(software_instance,
         self.computer_partition_portal_type)
 
@@ -4093,8 +4079,9 @@ class TestVifibSlapWebService(testVifibMixin):
   # ComputerPartition.request - shared
   ########################################
 
-  computer_with_software_release = prepare_computer + """
-      LoginDefaultUser
+  computer_with_software_release = """
+      CreateComputer
+      Tic
       CreatePurchasePackingList
       Tic
       CreatePurchasePackingListLine
@@ -4118,7 +4105,8 @@ class TestVifibSlapWebService(testVifibMixin):
       Tic
   """
   requesting_computer_partition_with_software_instance = """
-      LoginDefaultUser
+      SelectNewComputerPartitionReference
+      CreateComputerPartition
       CreateSalePackingList
       Tic
       CreateSalePackingListLine
@@ -4127,19 +4115,16 @@ class TestVifibSlapWebService(testVifibMixin):
       SetSalePackingListLineAggregate
       ConfirmSalePackingList
       Tic
-      Logout
   """
 
   slave_owner_computer_partition_with_software_instance = """
+      SelectNewComputerPartitionReference
+      CreateComputerPartition
+      SetSoftwareInstanceTitle
       CreateSalePackingList
       Tic
       CreateSalePackingListLine
       Tic
-      LoginTestVifibCustomer
-      stepPersonRequestSoftwareInstance
-      Tic
-      Logout
-      LoginDefaultUser
       SetSalePackingListLineSetupResource
       SetSalePackingListLineAggregate
       ConfirmSalePackingList
@@ -4150,41 +4135,29 @@ class TestVifibSlapWebService(testVifibMixin):
   """
 
   check_positive_request_shared = """
-      LoginDefaultUser
-      SlapLoginCurrentSoftwareInstance
       RequestSharedComputerPartitionNotReadyResponse
       Tic
       RequestSharedComputerPartition
-      Tic
       CheckSoftwareInstanceAndRelatedSlavePartition
       CheckRequestedSoftwareInstanceAndRelatedSlavePartition
-      Logout
   """
 
+  @skip('Not implemented')
   def test_ComputerPartition_request_shared_simpleCase(self):
     """
     Check that requesting shared partition works in system capable to fulfill
     such request, with existing slave partition
     """
     sequence_list = SequenceList()
-    sequence_string = self.computer_with_software_release + """
-        SelectNewComputerPartitionReference
-        CreateComputerPartition
+    sequence_string = \
+        self.computer_with_software_release +\
+        self.slave_owner_computer_partition_with_software_instance +\
+        """
+      CreateSlavePartition
+      Tic
         """ +\
-        self.slave_owner_computer_partition_with_software_instance + """
-        LoginTestVifibAdmin
-        CreateSlavePartition
-        Tic
-        CreateSlavePartition
-        Tic
-        SlapLoginCurrentComputer
-        FormatComputer
-        SlapLogout
-        LoginTestVifibAdmin
-        Tic
-        ReplaceComputerPartitionBySlavePartition
-      """ + self.check_positive_request_shared
-
+        self.requesting_computer_partition_with_software_instance +\
+        self.check_positive_request_shared
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self)
 
@@ -4196,19 +4169,14 @@ class TestVifibSlapWebService(testVifibMixin):
     """
     sequence_list = SequenceList()
     sequence_string = \
-        self.computer_with_software_release + """
-        SelectNewComputerPartitionReference
-        CreateComputerPartition
-        """ +\
+        self.computer_with_software_release +\
         self.slave_owner_computer_partition_with_software_instance +\
         self.requesting_computer_partition_with_software_instance +\
         self.check_positive_request_shared
-
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self)
 
   check_notfound_request_shared = """
-      SlapLoginCurrentSoftwareInstance
       RequestSharedComputerPartitionNotFoundResponse
   """
 
@@ -4220,20 +4188,16 @@ class TestVifibSlapWebService(testVifibMixin):
     """
     sequence_list = SequenceList()
     sequence_string = \
-        self.computer_with_software_release + """
-        SelectNewComputerPartitionReference
-        CreateComputerPartition
-        """ + self.slave_owner_computer_partition_with_software_instance +\
+        self.computer_with_software_release +\
+        self.slave_owner_computer_partition_with_software_instance +\
         """
-          CreateSlavePartition
-          Tic
-          MarkSlavePartitionBusy
-          Tic
-          SelectRequestedReference
+      CreateSlavePartition
+      Tic
+      MarkSlavePartitionBusy
+      Tic
         """ +\
         self.requesting_computer_partition_with_software_instance +\
         self.check_notfound_request_shared
-
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self)
 
-- 
2.30.9