Commit be462165 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: use person.getUserId() instead person.getReference()

Follow up implementation of ERP5LoginUserManager.
parent 3ba9c9cf
...@@ -163,7 +163,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -163,7 +163,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
def test_approveComputerRegistration(self): def test_approveComputerRegistration(self):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
computer = self.portal.computer_module.newContent(portal_type='Computer', computer = self.portal.computer_module.newContent(portal_type='Computer',
title="Computer %s for %s" % (new_id, self.person_user.getReference()), title="Computer %s for %s" % (new_id, self.person_user.getReference()),
...@@ -233,7 +233,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -233,7 +233,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
self.assertRaises(TypeError, self.computer.requestSoftwareRelease, self.assertRaises(TypeError, self.computer.requestSoftwareRelease,
state='available') state='available')
transaction.abort() transaction.abort()
...@@ -242,7 +242,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -242,7 +242,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.assertRaises(TypeError, self.computer.requestSoftwareRelease, self.assertRaises(TypeError, self.computer.requestSoftwareRelease,
software_release_url=url) software_release_url=url)
...@@ -252,7 +252,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -252,7 +252,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.computer.requestSoftwareRelease(software_release_url=url, self.computer.requestSoftwareRelease(software_release_url=url,
state='available') state='available')
...@@ -268,7 +268,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -268,7 +268,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.computer.requestSoftwareRelease(software_release_url=url, self.computer.requestSoftwareRelease(software_release_url=url,
state='destroyed') state='destroyed')
...@@ -282,7 +282,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -282,7 +282,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.computer.requestSoftwareRelease(software_release_url=url, self.computer.requestSoftwareRelease(software_release_url=url,
state='available') state='available')
...@@ -310,7 +310,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -310,7 +310,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.computer.requestSoftwareRelease(software_release_url=url, self.computer.requestSoftwareRelease(software_release_url=url,
state='available') state='available')
...@@ -325,7 +325,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -325,7 +325,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self._makePerson() self._makePerson()
self.computer.edit(source_administration=self.person_user.getRelativeUrl()) self.computer.edit(source_administration=self.person_user.getRelativeUrl())
self.tic() self.tic()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
url = self.generateNewSoftwareReleaseUrl() url = self.generateNewSoftwareReleaseUrl()
self.computer.requestSoftwareRelease(software_release_url=url, self.computer.requestSoftwareRelease(software_release_url=url,
state='available') state='available')
...@@ -416,7 +416,7 @@ class TestSlapOSCorePersonComputerSupply(testSlapOSMixin): ...@@ -416,7 +416,7 @@ class TestSlapOSCorePersonComputerSupply(testSlapOSMixin):
self.tic() self.tic()
# Login as new user # Login as new user
self.login(person_user.getReference()) self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
...@@ -988,7 +988,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -988,7 +988,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin):
sla_xml=sla_xml, sla_xml=sla_xml,
) )
transaction.abort() transaction.abort()
# no sla_xml # no sla_xml
self.assertRaises(TypeError, self.instance.requestStop, self.assertRaises(TypeError, self.instance.requestStop,
software_release=software_release, software_release=software_release,
...@@ -1056,7 +1056,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -1056,7 +1056,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin):
sla_xml=sla_xml, sla_xml=sla_xml,
) )
transaction.abort() transaction.abort()
# no sla_xml # no sla_xml
self.assertRaises(TypeError, self.instance.requestStart, self.assertRaises(TypeError, self.instance.requestStart,
software_release=software_release, software_release=software_release,
...@@ -1958,7 +1958,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin): ...@@ -1958,7 +1958,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin):
self.tic() self.tic()
# Login as new user # Login as new user
self.login(person_user.getReference()) self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
...@@ -2145,7 +2145,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin): ...@@ -2145,7 +2145,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin):
state=state, state=state,
) )
hosting_subscription = person.REQUEST.get('request_hosting_subscription') hosting_subscription = person.REQUEST.get('request_hosting_subscription')
self.assertEquals("Hosting Subscription", self.assertEquals("Hosting Subscription",
hosting_subscription.getPortalType()) hosting_subscription.getPortalType())
def test_Person_requestSoftwareInstance_createHostingSubscription(self): def test_Person_requestSoftwareInstance_createHostingSubscription(self):
...@@ -2163,7 +2163,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin): ...@@ -2163,7 +2163,7 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin):
state = "started" state = "started"
previous_id = self.getPortalObject().portal_ids\ previous_id = self.getPortalObject().portal_ids\
.generateNewId(id_group='slap_hosting_subscription_reference', .generateNewId(id_group='slap_hosting_subscription_reference',
id_generator='uid') id_generator='uid')
person.requestSoftwareInstance( person.requestSoftwareInstance(
...@@ -2520,7 +2520,7 @@ class TestSlapOSCorePersonRequestComputer(testSlapOSMixin): ...@@ -2520,7 +2520,7 @@ class TestSlapOSCorePersonRequestComputer(testSlapOSMixin):
self.tic() self.tic()
# Login as new user # Login as new user
self.login(person_user.getReference()) self.login(person_user.getUserId())
new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() new_person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl()) self.assertEquals(person_user.getRelativeUrl(), new_person.getRelativeUrl())
...@@ -2726,7 +2726,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2726,7 +2726,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def test_Computer_setSubjectList(self): def test_Computer_setSubjectList(self):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
computer = self.portal.computer_module.newContent( computer = self.portal.computer_module.newContent(
...@@ -2743,7 +2743,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2743,7 +2743,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def check_Instance_validate(self, portal_type): def check_Instance_validate(self, portal_type):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
instance = self.portal.software_instance_module.newContent( instance = self.portal.software_instance_module.newContent(
...@@ -2759,7 +2759,9 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2759,7 +2759,9 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
return self.activeSense_call() return self.activeSense_call()
# Replace activeSense by a dummy method # Replace activeSense by a dummy method
from Products.ERP5Type.Document.Alarm import Alarm class Alarm:
pass
#from Products.ERP5Type.Document.Alarm import Alarm
Alarm.activeSense_call = Alarm.activeSense Alarm.activeSense_call = Alarm.activeSense
Alarm.activeSense = verify_activeSense_call Alarm.activeSense = verify_activeSense_call
try: try:
...@@ -2780,7 +2782,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2780,7 +2782,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def test_SlaveInstance_requestDestroy(self): def test_SlaveInstance_requestDestroy(self):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
instance = self.portal.software_instance_module.newContent( instance = self.portal.software_instance_module.newContent(
portal_type='Slave Instance', portal_type='Slave Instance',
...@@ -2804,7 +2806,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2804,7 +2806,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def check_SoftwareInstallation_changeState(self, method_id): def check_SoftwareInstallation_changeState(self, method_id):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
computer = self.portal.computer_module.newContent( computer = self.portal.computer_module.newContent(
portal_type='Computer', portal_type='Computer',
...@@ -2845,7 +2847,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2845,7 +2847,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def check_SoftwareInstance_changeState(self, method_id): def check_SoftwareInstance_changeState(self, method_id):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
computer = self.portal.computer_module.newContent( computer = self.portal.computer_module.newContent(
...@@ -2880,7 +2882,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2880,7 +2882,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def verify_reindexObject_call(self, *args, **kw): def verify_reindexObject_call(self, *args, **kw):
if self.getRelativeUrl() == partition.getRelativeUrl(): if self.getRelativeUrl() == partition.getRelativeUrl():
partition.portal_workflow.doActionFor(partition, action='edit_action', partition.portal_workflow.doActionFor(partition, action='edit_action',
comment='reindexObject triggered on %s' % method_id) comment='reindexObject triggered on %s' % method_id)
else: else:
return self.reindexObject_call(*args, **kw) return self.reindexObject_call(*args, **kw)
...@@ -2909,7 +2911,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2909,7 +2911,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def check_change_instance_parameter(self, portal_type, method_id): def check_change_instance_parameter(self, portal_type, method_id):
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
instance = self.portal.software_instance_module.newContent( instance = self.portal.software_instance_module.newContent(
...@@ -2966,7 +2968,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -2966,7 +2968,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
portal_type = "Software Instance" portal_type = "Software Instance"
self._makePerson() self._makePerson()
self.login(self.person_user.getReference()) self.login(self.person_user.getUserId())
new_id = self.generateNewId() new_id = self.generateNewId()
instance3 = self.portal.software_instance_module.newContent( instance3 = self.portal.software_instance_module.newContent(
...@@ -3005,7 +3007,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): ...@@ -3005,7 +3007,7 @@ class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin):
def verify_reindexObject_call(self, *args, **kw): def verify_reindexObject_call(self, *args, **kw):
if self.getRelativeUrl() in (instance2.getRelativeUrl(), if self.getRelativeUrl() in (instance2.getRelativeUrl(),
instance3.getRelativeUrl()): instance3.getRelativeUrl()):
self.portal_workflow.doActionFor(instance1, action='edit_action', self.portal_workflow.doActionFor(instance1, action='edit_action',
comment='reindexObject triggered') comment='reindexObject triggered')
else: else:
return self.reindexObject_call(*args, **kw) return self.reindexObject_call(*args, **kw)
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSCloudWorkflow</string> </value> <value> <string>testSlapOSCloudWorkflow</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSCloudWorkflow</string> </value> <value> <string>test.erp5.testSlapOSCloudWorkflow</string> </value>
...@@ -27,9 +39,7 @@ ...@@ -27,9 +39,7 @@
<item> <item>
<key> <string>text_content_error_message</string> </key> <key> <string>text_content_error_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>F:2762, 4: Unable to import \'Products.ERP5Type.Document.Alarm\' (import-error)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -45,13 +55,28 @@ ...@@ -45,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -64,7 +89,7 @@ ...@@ -64,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -73,7 +98,7 @@ ...@@ -73,7 +98,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
......
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