Commit c90321d2 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: (test) Update capacity scope separatly them allocation_scope

By updating allocation_scope the capacity_scope can be automatically updated.
parent b2ba7940
...@@ -189,10 +189,13 @@ class SlapOSTestCaseMixin(testSlapOSMixin): ...@@ -189,10 +189,13 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
reference = 'TESTCOMP-%s' % self.generateNewId() reference = 'TESTCOMP-%s' % self.generateNewId()
self.computer.edit( self.computer.edit(
allocation_scope='open/public', allocation_scope='open/public',
capacity_scope='open',
reference=reference, reference=reference,
title=reference title=reference
) )
# The edit above will update capacity scope due the interaction workflow
# The line above force capacity scope to be open, keeping the previous
# behaviour.
self.computer.edit(capacity_scope='open')
self.computer.validate() self.computer.validate()
reference = 'TESTPART-%s' % self.generateNewId() reference = 'TESTPART-%s' % self.generateNewId()
self.partition = self.computer.newContent(portal_type='Computer Partition', self.partition = self.computer.newContent(portal_type='Computer Partition',
......
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:438, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)</string> <string>W:441, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)</string>
<string>W:441, 0: Cannot decode using encoding "ascii", unexpected byte at position 17 (invalid-encoded-data)</string> <string>W:444, 0: Cannot decode using encoding "ascii", unexpected byte at position 17 (invalid-encoded-data)</string>
<string>W:444, 0: Cannot decode using encoding "ascii", unexpected byte at position 18 (invalid-encoded-data)</string> <string>W:447, 0: Cannot decode using encoding "ascii", unexpected byte at position 18 (invalid-encoded-data)</string>
<string>W:449, 0: Cannot decode using encoding "ascii", unexpected byte at position 13 (invalid-encoded-data)</string> <string>W:452, 0: Cannot decode using encoding "ascii", unexpected byte at position 13 (invalid-encoded-data)</string>
<string>W:460, 0: Cannot decode using encoding "ascii", unexpected byte at position 14 (invalid-encoded-data)</string> <string>W:463, 0: Cannot decode using encoding "ascii", unexpected byte at position 14 (invalid-encoded-data)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -415,6 +415,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S ...@@ -415,6 +415,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self._makeTree() self._makeTree()
self._makeComputer() self._makeComputer()
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self._installSoftware(self.computer, self._installSoftware(self.computer,
self.software_instance.getUrlString()) self.software_instance.getUrlString())
...@@ -821,7 +824,12 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S ...@@ -821,7 +824,12 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
self._makeTree() self._makeTree()
self._makeComputer() self._makeComputer()
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self.computer.edit(**{base_category: computer_category}) self.computer.edit(**{base_category: computer_category})
self.assertEquals(self.computer.getAllocationScope(), "open/public")
self.assertEquals(self.computer.getCapacityScope(), "open")
self._installSoftware(self.computer, self._installSoftware(self.computer,
self.software_instance.getUrlString()) self.software_instance.getUrlString())
...@@ -852,6 +860,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S ...@@ -852,6 +860,9 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
<parameter id='%s'>%s</parameter> <parameter id='%s'>%s</parameter>
</instance>""" % (base_category, computer_category)) </instance>""" % (base_category, computer_category))
self.software_instance.SoftwareInstance_tryToAllocatePartition() self.software_instance.SoftwareInstance_tryToAllocatePartition()
if self.software_instance.getAggregate(portal_type='Computer Partition') is None:
raise ValueError(self.software_instance)
self.assertEqual(self.partition.getRelativeUrl(), self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Computer Partition')) self.software_instance.getAggregate(portal_type='Computer Partition'))
...@@ -1350,9 +1361,9 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(SlapOSTestCaseMixin): ...@@ -1350,9 +1361,9 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(SlapOSTestCaseMixin):
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
self.computer.edit( self.computer.edit(
allocation_scope='open/public', allocation_scope='open/public',
capacity_scope='open',
reference='TESTC-%s' % self.generateNewId(), reference='TESTC-%s' % self.generateNewId(),
) )
self.computer.edit(capacity_scope='open')
self.computer.validate() self.computer.validate()
memcached_dict = self.portal.portal_memcached.getMemcachedDict( memcached_dict = self.portal.portal_memcached.getMemcachedDict(
key_prefix='slap_tool', key_prefix='slap_tool',
......
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