Commit 2e1529e4 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: no requestTransfer anymore

parent c27a7ac5
......@@ -21,8 +21,6 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
import transaction
from unittest import expectedFailure
from time import sleep
from zExceptions import Unauthorized
class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
"""Tests instance.requestInstance"""
......@@ -950,202 +948,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.tic()
return organisation
def test_RequesterInstance_requestTransfer_Unauthorized(self):
destination_section = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.login()
self.assertRaises(Unauthorized, self.instance_tree.requestTransfer,
destination=None,
destination_project=None)
self.login(destination_section.getUserId())
self.assertRaises(Unauthorized, self.instance_tree.requestTransfer,
destination=None,
destination_project=None)
self.login()
other_user = self.makePerson(self.project, user=1)
self.assertEqual(1 , len(other_user.objectValues(portal_type="ERP5 Login")))
self.instance_tree.setDestinationSectionValue(destination_section)
self.tic()
self.assertRaises(Unauthorized, self.instance_tree.requestTransfer,
destination=None,
destination_project=None)
self.login(other_user.getUserId())
self.assertRaises(Unauthorized, self.instance_tree.requestTransfer,
destination=None,
destination_project=None)
self.login(destination_section.getUserId())
self.assertEqual(self.instance_tree.requestTransfer(
destination=None,
destination_project=None), None)
def test_RequesterInstance_requestTransfer_project(self):
destination_section = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.instance_tree.setDestinationSectionValue(destination_section)
self.login()
project = self._makeProject()
other_project = self._makeProject()
self.tic()
self.login(destination_section.getUserId())
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), None)
# Place in a project
self.assertEqual(self.instance_tree.requestTransfer(
destination=None,
destination_project=project.getRelativeUrl()), None)
self.tic()
self.assertEqual(
self.instance_tree.Item_getCurrentProjectValue(), project)
self.assertEqual(
self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(
self.instance_tree.Item_getCurrentSiteValue(), None)
self.assertEqual(1,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
self.login(destination_section.getUserId())
# We don't remove from Project if destination project is not provided
self.assertEqual(self.instance_tree.requestTransfer(
destination=None,
destination_project=None), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), project)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(2,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
# Place in another project
self.assertEqual(self.instance_tree.requestTransfer(
destination=None,
destination_project=other_project.getRelativeUrl()), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), other_project)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), None)
self.assertEqual(3,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
self.login(destination_section.getUserId())
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
# We don't remove from Project if destination project is not provided
self.assertEqual(self.instance_tree.requestTransfer(
destination_project=None,
destination=None), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), other_project)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), None)
self.assertEqual(4,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
def test_RequesterInstance_requestTransfer_owner(self):
destination_section = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
self.instance_tree.setDestinationSectionValue(destination_section)
self.login()
organisation = self._makeOrganisation()
other_organisation = self._makeOrganisation()
self.tic()
self.login(destination_section.getUserId())
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), None)
self.assertEqual(self.instance_tree.requestTransfer(
destination=organisation.getRelativeUrl(),
destination_project=None), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), organisation)
self.assertEqual(1,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
self.login(destination_section.getUserId())
self.assertEqual(self.instance_tree.requestTransfer(
destination_project=None,
destination=None), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), organisation)
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
# Place in another project
self.assertEqual(self.instance_tree.requestTransfer(
destination_project=None,
destination=other_organisation.getRelativeUrl()), None)
self.tic()
self.assertEqual(3,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), other_organisation)
self.assertEqual(3,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
self.login(destination_section.getUserId())
# Ensure that we don't have 2 new Internal Packing lists in the same second
sleep(1)
# We don't remove from Project if destination project is not provided
self.assertEqual(self.instance_tree.requestTransfer(
destination_project=None,
destination=None), None)
self.tic()
self.assertEqual(self.instance_tree.Item_getCurrentProjectValue(), None)
self.assertEqual(self.instance_tree.Item_getCurrentOwnerValue(), destination_section)
self.assertEqual(self.instance_tree.Item_getCurrentSiteValue(), other_organisation)
self.assertEqual(4,
len(self.instance_tree.getAggregateRelatedList(portal_type="Internal Packing List Line"))
)
def test_generateCertificate(self):
self.login()
self.software_instance.setSslKey(None)
......
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