Commit 72b56997 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: use getUserId API instead person reference to login

This API was changed, so follow up changes which come from ERP5.
parent 6f7a3ef2
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
import unittest import unittest
import random import random
import transaction
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.SlapOS.tests.testSlapOSMixin import testSlapOSMixin from Products.SlapOS.tests.testSlapOSMixin import testSlapOSMixin
...@@ -161,23 +160,27 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -161,23 +160,27 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
reference=reference, password=password) reference=reference, password=password)
person.newContent(portal_type='Assignment').open() person.newContent(portal_type='Assignment').open()
transaction.commit() self.commit()
person.recursiveImmediateReindexObject() person.recursiveImmediateReindexObject()
self._assertUserExists(reference, password) self._assertUserExists(reference, password)
self.login(reference) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertTrue('Authenticated' in user.getRoles())
self.assertSameSet([], user.getGroups()) self.assertSameSet([], user.getGroups())
# add to group category # add to group category
self.login() self.login()
person.newContent(portal_type='Assignment', group='company').open() person.newContent(portal_type='Assignment', group='company').open()
self.commit()
person.recursiveImmediateReindexObject() person.recursiveImmediateReindexObject()
self.tic()
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(reference) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertTrue('Authenticated' in user.getRoles())
self.assertSameSet(['G-COMPANY'], user.getGroups()) self.assertSameSet(['G-COMPANY'], user.getGroups())
...@@ -188,7 +191,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -188,7 +191,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
person.recursiveImmediateReindexObject() person.recursiveImmediateReindexObject()
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
self.login(reference) self.login(person.getUserId())
user = getSecurityManager().getUser() user = getSecurityManager().getUser()
self.assertTrue('Authenticated' in user.getRoles()) self.assertTrue('Authenticated' in user.getRoles())
self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups()) self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups())
...@@ -199,7 +202,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin): ...@@ -199,7 +202,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
reference=reference, password=password) reference=reference, password=password)
transaction.commit() self.commit()
person.recursiveImmediateReindexObject() person.recursiveImmediateReindexObject()
self._assertUserDoesNotExists(reference, password) self._assertUserDoesNotExists(reference, password)
......
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