Commit 7b527bd6 authored by Łukasz Nowak's avatar Łukasz Nowak

Make test more controllable.

As there is no way to have returned object, generate random value and reuse it
later to fetch exact object.

Also extended tests with Order Line checks.
parent 9ffff1f4
...@@ -3016,12 +3016,10 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -3016,12 +3016,10 @@ class TestVifibSlapWebService(testVifibMixin):
def stepCheckPersonRequestedSoftwareInstanceAndRelatedComputerPartition(self, def stepCheckPersonRequestedSoftwareInstanceAndRelatedComputerPartition(self,
sequence, **kw): sequence, **kw):
computer_partition = self.portal.portal_catalog.getResultValue( software_instance = self.portal.portal_catalog.getResultValue(
parent_uid=sequence['computer_uid'], uid=sequence['software_instance_uid'])
reference=sequence['requested_computer_partition_reference'], # in this test it is required to assume that requested_reference
portal_type='Computer Partition') computer_partition = self._softwareInstance_getComputerPartition()
software_instance = self._computerPartition_getSoftwareInstance(
computer_partition)
# There should be only one Sale Packing List Line # There should be only one Sale Packing List Line
sale_packing_list_line_list = software_instance\ sale_packing_list_line_list = software_instance\
.getAggregateRelatedValueList( .getAggregateRelatedValueList(
...@@ -3041,8 +3039,24 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -3041,8 +3039,24 @@ class TestVifibSlapWebService(testVifibMixin):
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type)
self.assertEqual(1, len(computer_partition_sale_packing_list_line_list)) self.assertEqual(1, len(computer_partition_sale_packing_list_line_list))
sequence['software_instance_reference'] = software_instance.getReference() # There should be only one Sale Order Line
sequence['software_instance_uid'] = software_instance.getUid() sale_order_line_list = software_instance\
.getAggregateRelatedValueList(
portal_type=self.sale_order_line_portal_type)
self.assertEqual(1, len(sale_order_line_list))
sale_order_line = sale_order_line_list[0]
# This Sale Order Line shall have only one Computer Partition
computer_partition_list = sale_order_line.getAggregateValueList(
portal_type='Computer Partition')
self.assertEqual(1, len(computer_partition_list))
computer_partition = computer_partition_list[0]
# This Computer Partition shall have only Sale Order Line related
computer_partition_sale_order_line_list = computer_partition\
.getAggregateRelatedValueList(
portal_type=self.sale_order_line_portal_type)
self.assertEqual(1, len(computer_partition_sale_order_line_list))
def stepCheckSoftwareInstanceAndRelatedComputerPartition(self, def stepCheckSoftwareInstanceAndRelatedComputerPartition(self,
sequence, **kw): sequence, **kw):
...@@ -7008,6 +7022,22 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -7008,6 +7022,22 @@ class TestVifibSlapWebService(testVifibMixin):
filter_kw=sequence.get('requested_filter_dict', {}) filter_kw=sequence.get('requested_filter_dict', {})
) )
def stepSetRandomRequestedReference(self, sequence, **kw):
sequence['requested_reference'] = self.id() + str(random())
def stepSetCurrentPersonSlapRequestedSoftwareInstance(self, sequence, **kw):
software_instance_list = self.portal.portal_catalog(
portal_type=self.software_instance_portal_type,
title=sequence['requested_reference'])
self.assertEqual(1, len(software_instance_list))
software_instance = software_instance_list[0]
sequence.edit(
software_instance_uid=software_instance.getUid(),
software_instance_reference=software_instance.getReference(),
hosting_subscription_uid=software_instance.getAggregateRelatedValue(
portal_type='Sale Order Line').getAggregateValue(
portal_type='Hosting Subscription').getUid())
def stepPersonRequestSlapSoftwareInstance(self, sequence, **kw): def stepPersonRequestSlapSoftwareInstance(self, sequence, **kw):
software_release = sequence['software_release_uri'] software_release = sequence['software_release_uri']
self.slap = slap.slap() self.slap = slap.slap()
...@@ -7016,8 +7046,7 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -7016,8 +7046,7 @@ class TestVifibSlapWebService(testVifibMixin):
requested_slap_computer_partition = open_order.request( requested_slap_computer_partition = open_order.request(
software_release=software_release, software_release=software_release,
software_type=sequence.get('software_type', 'software_type'), software_type=sequence.get('software_type', 'software_type'),
partition_reference=sequence.get('requested_reference', partition_reference=sequence['requested_reference'],
'requested_reference'),
partition_parameter_kw=sequence.get('requested_parameter_dict', {}), partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
filter_kw=sequence.get('requested_filter_dict', {})) filter_kw=sequence.get('requested_filter_dict', {}))
sequence.edit( sequence.edit(
...@@ -7043,6 +7072,7 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -7043,6 +7072,7 @@ class TestVifibSlapWebService(testVifibMixin):
Tic Tic
SlapLogout SlapLogout
SetRandomRequestedReference
SlapLoginTestVifibCustomer SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstanceNotReadyResponse PersonRequestSlapSoftwareInstanceNotReadyResponse
Tic Tic
...@@ -7064,6 +7094,7 @@ class TestVifibSlapWebService(testVifibMixin): ...@@ -7064,6 +7094,7 @@ class TestVifibSlapWebService(testVifibMixin):
SlapLogout SlapLogout
LoginDefaultUser LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
CheckPersonRequestedSoftwareInstanceAndRelatedComputerPartition CheckPersonRequestedSoftwareInstanceAndRelatedComputerPartition
Logout Logout
......
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