Commit 3ca1ad85 authored by Romain Courteaud's avatar Romain Courteaud

Allow to change the software type of a instance.

This fix OpenOrder.request software type modification
parent 0285c081
......@@ -74,13 +74,12 @@ if is_slave == True:\n
else:\n
software_instance_portal_type = "Software Instance"\n
\n
tag = "%s_%s_%s_inProgress" % (person.getUid(), software_type, \n
tag = "%s_%s_inProgress" % (person.getUid(), \n
software_title)\n
\n
# Check if it already exists\n
request_software_instance = portal.portal_catalog.getResultValue(\n
portal_type=software_instance_portal_type,\n
source_reference=software_type,\n
title=software_title,\n
)\n
if (request_software_instance is None):\n
......@@ -176,6 +175,7 @@ else:\n
# Update existing software instance\n
request_software_instance.edit(\n
text_content=instance_xml,\n
source_reference=software_type,\n
sla_xml=sla_xml,\n
activate_kw={\'tag\': tag},\n
)\n
......
......@@ -186,6 +186,85 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetFirstSoftwareType(self, sequence,
**kw):
sequence.edit(software_type="FirstSoftwareType")
def stepPersonRequestSlapSoftwareInstanceWithAnotherSoftwareType(
self, sequence, **kw):
software_release = sequence['software_release_uri']
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request(
software_release=software_release,
software_type="SecondSoftwareType",
partition_reference=sequence['requested_reference'],
partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
filter_kw=sequence.get('requested_filter_dict', {}))
def stepCheckPersonRequestSlapSoftwareInstanceWithAnotherSoftwareType(
self, sequence, **kw):
software_release = sequence['software_release_uri']
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request(
software_release=software_release,
software_type="SecondSoftwareType",
partition_reference=sequence['requested_reference'],
partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
filter_kw=sequence.get('requested_filter_dict', {}))
self.assertEquals(sequence.get('requested_computer_partition_reference'),
requested_slap_computer_partition.getId())
self.assertEquals("SecondSoftwareType",
requested_slap_computer_partition.getInstanceParameterDict()['slap_software_type'])
self.assertEquals(1,
requested_slap_computer_partition._need_modification)
def test_OpenOrder_request_changeSoftwareType(self):
"""
Check that requesting the same instance with a different software type
does not create a new instance
"""
self.computer_partition_amount = 1
sequence_list = SequenceList()
sequence_string = self.prepare_published_software_release + \
self.prepare_formated_computer + """
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
SetRandomRequestedReference
SlapLoginTestVifibCustomer
SetFirstSoftwareType
PersonRequestSlapSoftwareInstancePrepare
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstance
Tic
PersonRequestSlapSoftwareInstanceWithAnotherSoftwareType
Tic
CheckPersonRequestSlapSoftwareInstanceWithAnotherSoftwareType
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapOpenOrderRequest))
......
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