Commit 3df8d4f2 authored by Łukasz Nowak's avatar Łukasz Nowak

Initialise local_permission_slapos_interaction_workflow testing.

parent b0488ab9
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from testSlapOSGroupRoleSecurity import TestSlapOSGroupRoleSecurityMixin
import transaction
class TestSlapOSLocalPermissionSlapOSInteractionWorkflow(
TestSlapOSGroupRoleSecurityMixin):
def _makePerson(self):
new_id = self.generateNewId()
self.person_user = self.portal.person_module.template_member.\
Base_createCloneDocument(batch_mode=1)
self.person_user.edit(
title="live_test_%s" % new_id,
reference="live_test_%s" % new_id,
)
self.person_reference = self.person_user.getReference()
def test_ComputerModel_edit(self):
self._makePerson()
model = self.portal.computer_model_module.newContent(
portal_type='Computer Model')
self.assertSecurityGroup(model, ['G-COMPANY', self.user_id], False)
model.edit(source_administration=self.person_user.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(model,
['G-COMPANY', self.user_id, self.person_reference], False)
def test_ComputerNetwork_edit(self):
self._makePerson()
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network')
self.assertSecurityGroup(network, ['G-COMPANY', self.user_id,
'R-SHADOW-PERSON'], False)
network.edit(source_administration=self.person_user.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(network,
['G-COMPANY', self.user_id, self.person_reference, 'R-SHADOW-PERSON'],
False)
def test_Computer_setReference(self):
computer = self.portal.computer_module.newContent(portal_type='Computer')
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id], False)
computer.edit(reference='TESTCOMP-%s' % self.generateNewId())
transaction.commit()
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id,
computer.getReference()], False)
def test_Computer_setSourceAdministration(self):
self._makePerson()
computer = self.portal.computer_module.newContent(
portal_type='Computer')
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id], False)
computer.edit(source_administration=self.person_user.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id,
self.person_reference], False)
def test_Computer_setAllocationScope(self):
computer = self.portal.computer_module.newContent(portal_type='Computer')
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id], False)
computer.edit(allocation_scope='open/public')
transaction.commit()
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id,
'R-SHADOW-PERSON'], False)
def test_Computer_setDestinationSection(self):
self._makePerson()
computer = self.portal.computer_module.newContent(
portal_type='Computer')
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id], False)
computer.edit(source_administration=self.person_user.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(computer, ['G-COMPANY', self.user_id,
self.person_reference], False)
def test_Computer_reindexObject(self):
computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1)
self.tic()
comment = 'recursiveReindexObject triggered on reindexObject'
def verify_recursiveReindexObject_call(self, *args, **kw):
if self.getRelativeUrl() == computer.getRelativeUrl():
if computer.workflow_history['edit_workflow'][-1]['comment'] != comment:
computer.portal_workflow.doActionFor(computer, action='edit_action',
comment=comment)
else:
return self.recursiveReindexObject_call(*args, **kw)
# Replace recursiveReindexObject by a dummy method
from Products.ERP5Type.Core.Folder import Folder
Folder.recursiveReindexObject_call = Folder.recursiveReindexObject
Folder.recursiveReindexObject = verify_recursiveReindexObject_call
try:
computer.reindexObject()
self.tic()
finally:
Folder.recursiveReindexObject = Folder.recursiveReindexObject_call
self.assertEqual(comment,
computer.workflow_history['edit_workflow'][-1]['comment'])
61
\ No newline at end of file
62
\ No newline at end of file
......@@ -2,6 +2,7 @@ computer_model_module
computer_module
computer_network_module
credential_update_module
data_set_module
document_module
hosting_subscription_module
image_module
......@@ -11,5 +12,4 @@ portal_contributions
software_installation_module
software_instance_module
software_product_module
software_release_module
data_set_module
\ No newline at end of file
software_release_module
\ No newline at end of file
testSlapOSGroupRoleSecurity
testSlapOSLocalPermissionSlapOSInteractionWorkflow
testSlapOSSkinSelection
\ 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