[Erp5-report] r29805 - /erp5/trunk/products/ERP5/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Oct 19 17:27:19 CEST 2009


Author: nicolas.dumazet
Date: Mon Oct 19 17:27:19 2009
New Revision: 29805

URL: http://svn.erp5.org?rev=29805&view=rev
Log:
Use ERP5TestCase.login instead of local methods.
Drop unused changeToPreviousUser method

Modified:
    erp5/trunk/products/ERP5/tests/testNotificationMessageModule.py
    erp5/trunk/products/ERP5/tests/testNotificationTool.py
    erp5/trunk/products/ERP5/tests/testPDM.py

Modified: erp5/trunk/products/ERP5/tests/testNotificationMessageModule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testNotificationMessageModule.py?rev=29805&r1=29804&r2=29805&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testNotificationMessageModule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testNotificationMessageModule.py [utf8] Mon Oct 19 17:27:19 2009
@@ -56,15 +56,6 @@
     user_folder = self.getPortal().acl_users
     user_folder._doAddUser(name, 'password', role_list, [])
 
-  def changeUser(self, name):
-    self.old_user = getSecurityManager().getUser()
-    user_folder = self.getPortal().acl_users
-    user = user_folder.getUserById(name).__of__(user_folder)
-    newSecurityManager(None, user)
-
-  def changeToPreviousUser(self):
-    newSecurityManager(None, self.old_user)
-
   def afterSetUp(self):
     self.createUser('erp5user', ['Auditor', 'Author'])
     self.createUser('manager', ['Manager'])
@@ -76,7 +67,7 @@
     self.portal.portal_caches.clearAllCache()
     transaction.commit()
     self.tic()
-    self.changeUser('erp5user')
+    self.login('erp5user')
 
   def beforeTearDown(self):
     transaction.abort()

Modified: erp5/trunk/products/ERP5/tests/testNotificationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testNotificationTool.py?rev=29805&r1=29804&r2=29805&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testNotificationTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testNotificationTool.py [utf8] Mon Oct 19 17:27:19 2009
@@ -114,9 +114,7 @@
 
   def changeUser(self, name):
     self.old_user = getSecurityManager().getUser()
-    user_folder = self.getPortal().acl_users
-    user = user_folder.getUserById(name).__of__(user_folder)
-    newSecurityManager(None, user)
+    self.login(name)
 
   def changeToPreviousUser(self):
     newSecurityManager(None, self.old_user)
@@ -132,7 +130,7 @@
     self.portal.portal_caches.clearAllCache()
     transaction.commit()
     self.tic()
-    self.changeUser('erp5user')
+    self.login('erp5user')
 
   def beforeTearDown(self):
     transaction.abort()

Modified: erp5/trunk/products/ERP5/tests/testPDM.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testPDM.py?rev=29805&r1=29804&r2=29805&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testPDM.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testPDM.py [utf8] Mon Oct 19 17:27:19 2009
@@ -61,16 +61,11 @@
     transaction.commit()
     self.tic()
 
-  def changeUser(self, name):
-    user_folder = self.getPortal().acl_users
-    user = user_folder.getUserById(name).__of__(user_folder)
-    newSecurityManager(None, user)
-
   def testValidatedProductCanContainMeasure(self):
     """
     Make sure that validated product can contain measure.
     """
-    self.changeUser('author')
+    self.login('author')
     product = self.portal.product_module.newContent(portal_type='Product',
                                                     title='Chair')
 
@@ -85,7 +80,7 @@
 
     self.assertEqual(len(product.contentValues(portal_type='Measure')), 1)
 
-    self.changeUser('assignor')
+    self.login('assignor')
     self.portal.portal_workflow.doActionFor(product, 'validate_action')
 
     transaction.commit()
@@ -94,12 +89,12 @@
     self.assertEqual(product.getValidationState(), 'validated')
 
     # Change to author and try to add a measure to validated product and fail.
-    self.changeUser('author')
+    self.login('author')
     self.assertRaises(AccessControl_Unauthorized,
                       product.newContent, portal_type='Measure')
 
     # Change to assignee and try to add a measure to validated product and succeed.
-    self.changeUser('assignee')
+    self.login('assignee')
     product.newContent(portal_type='Measure')
 
     transaction.commit()




More information about the Erp5-report mailing list