Commit 8b81ece3 authored by Łukasz Nowak's avatar Łukasz Nowak

Test computer_partition_slap_interface_workflow.

parent 6d32aee3
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
class TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow(testSlapOSMixin):
def afterSetUp(self):
super(TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow, self).afterSetUp()
# Clone computer document
self.computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1)
new_id = self.generateNewId()
self.computer.edit(
title="computer %s" % (new_id, ),
reference="TESTCOMP-%s" % (new_id, ),
allocation_scope='open/personal',
capacity_scope='open',
)
self.computer.validate()
# install an software release
self.software_installation = self.portal.software_installation_module\
.newContent(portal_type='Software Installation',
url_string=self.generateNewSoftwareReleaseUrl(),
aggregate=self.computer.getRelativeUrl())
self.software_installation.validate()
self.software_installation.requestStart()
self.tic()
def test_markFree(self):
self.login(self.computer.getReference())
partition = self.computer.newContent(portal_type='Computer Partition',
reference='PART-%s' % self.generateNewId())
partition.validate()
partition.markFree()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
def test_markFree_markBusy(self):
self.login(self.computer.getReference())
partition = self.computer.newContent(portal_type='Computer Partition',
reference='PART-%s' % self.generateNewId())
partition.validate()
partition.markFree()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
partition.markBusy()
self.tic()
self.assertEqual(0, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
def test_markFree_markBusy_markFree(self):
self.login(self.computer.getReference())
partition = self.computer.newContent(portal_type='Computer Partition',
reference='PART-%s' % self.generateNewId())
partition.validate()
partition.markFree()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
partition.markBusy()
self.tic()
self.assertEqual(0, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
partition.markFree()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
def test_markInactive(self):
self.login(self.computer.getReference())
partition = self.computer.newContent(portal_type='Computer Partition',
reference='PART-%s' % self.generateNewId())
partition.validate()
partition.markInactive()
self.tic()
self.assertEqual(0, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
def test_markInactive_markFree(self):
self.login(self.computer.getReference())
partition = self.computer.newContent(portal_type='Computer Partition',
reference='PART-%s' % self.generateNewId())
partition.validate()
partition.markInactive()
self.tic()
self.assertEqual(0, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
partition.markFree()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
166 167
\ No newline at end of file \ No newline at end of file
...@@ -5,3 +5,4 @@ testSlapOSCoreSoftwareInstanceRequest ...@@ -5,3 +5,4 @@ testSlapOSCoreSoftwareInstanceRequest
testSlapOSShadow testSlapOSShadow
testSlapOSCoreAllocation testSlapOSCoreAllocation
testSlapOSCoreComputerSlapInterfaceWorkflow testSlapOSCoreComputerSlapInterfaceWorkflow
testSlapOSCoreComputerPartitionSlapInterfaceWorkflow
\ No newline at end of file
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