Commit 2c9ecc15 authored by Jérome Perrin's avatar Jérome Perrin

tests user creation workflow, and also tests that when a user is created, a

user preference is created for him.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35106 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7204ea05
...@@ -1501,6 +1501,33 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -1501,6 +1501,33 @@ class TestERP5Base(ERP5TypeTestCase):
# workflow is affected # workflow is affected
self.assertTrue(comment in [q['comment'] for q in workflow_history]) self.assertTrue(comment in [q['comment'] for q in workflow_history])
def test_user_creation(self):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
group='nexedi')
self.assertNotEquals(None, assignment.getGroupValue())
assignment.open()
self.portal.portal_workflow.doActionFor(person, 'create_user_action',
reference='user_login',
password='pass',
password_confirm='pass')
transaction.commit()
self.tic()
# a user is created
user = self.portal.acl_users.getUserById('user_login')
self.assertNotEquals(None, user)
# and this user has a preference created
newSecurityManager(None, user.__of__(self.portal.acl_users))
self.assertNotEquals(None,
self.portal.portal_catalog.getResultValue(portal_type='Preference',
owner='user_login'))
# for his assignent group
self.assertEquals('group/nexedi',
self.portal.portal_preferences.getPreferredSectionCategory())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Base)) suite.addTest(unittest.makeSuite(TestERP5Base))
......
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