[Erp5-report] r39167 luke - /erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 14 16:32:31 CEST 2010
Author: luke
Date: Thu Oct 14 16:32:30 2010
New Revision: 39167
URL: http://svn.erp5.org?rev=39167&view=rev
Log:
- add high level (no ZODB cache) scenario checks
- add test that shows if there is no special cache, no special cache is
used
Modified:
erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py
Modified: erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py?rev=39167&r1=39166&r2=39167&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py [utf8] (original)
+++ erp5/trunk/products/ERP5Wizard/tests/testERP5RemoteUserManager.py [utf8] Thu Oct 14 16:32:30 2010
@@ -330,6 +330,70 @@ class TestERP5RemoteUserManager(ERP5Type
finally:
WizardTool.callRemoteProxyMethod = original_callRemoteProxyMethod
+ def test_loggable_in_case_of_server_gaierror_normal_cache(self):
+ login = 'someone'
+ password = 'somepass'
+ self.createPerson(login, password)
+ transaction.commit()
+ self.tic()
+ kw = {'login':login, 'password': password}
+ expected = ('someone', 'someone')
+ sent = kw
+ self.assertEqual(expected,
+ self.erp5_remote_manager.authenticateCredentials(sent))
+ # patch Wizard Tool to raise in callRemoteProxyMethod
+ from Products.ERP5Wizard.Tool.WizardTool import WizardTool
+ original_callRemoteProxyMethod=WizardTool.callRemoteProxyMethod
+ try:
+ WizardTool.callRemoteProxyMethod = raises_socket_gaierror
+ self.assertRaises(socket.gaierror,
+ self.portal.portal_wizard.callRemoteProxyMethod)
+ self.assertEqual(expected,
+ self.erp5_remote_manager.authenticateCredentials(sent))
+ finally:
+ WizardTool.callRemoteProxyMethod = original_callRemoteProxyMethod
+
+ def test_loggable_in_case_of_server_raises_anythin_else_normal_cache(self):
+ login = 'someone'
+ password = 'somepass'
+ self.createPerson(login, password)
+ transaction.commit()
+ self.tic()
+ kw = {'login':login, 'password': password}
+ expected = ('someone', 'someone')
+ sent = kw
+ self.assertEqual(expected,
+ self.erp5_remote_manager.authenticateCredentials(sent))
+ # patch Wizard Tool to raise in callRemoteProxyMethod
+ from Products.ERP5Wizard.Tool.WizardTool import WizardTool
+ original_callRemoteProxyMethod=WizardTool.callRemoteProxyMethod
+ try:
+ WizardTool.callRemoteProxyMethod = raises_value_error
+ self.assertRaises(ValueError,
+ self.portal.portal_wizard.callRemoteProxyMethod)
+ self.assertEqual(expected,
+ self.erp5_remote_manager.authenticateCredentials(sent))
+ finally:
+ WizardTool.callRemoteProxyMethod = original_callRemoteProxyMethod
+
+ def test_not_loggable_in_case_of_server_gaierror_no_log_before(self):
+ login = 'someone'
+ password = 'somepass'
+ self.createPerson(login, password)
+ transaction.commit()
+ self.tic()
+ kw = {'login':login, 'password': password}
+ # patch Wizard Tool to raise in callRemoteProxyMethod
+ from Products.ERP5Wizard.Tool.WizardTool import WizardTool
+ original_callRemoteProxyMethod=WizardTool.callRemoteProxyMethod
+ try:
+ WizardTool.callRemoteProxyMethod = raises_socket_gaierror
+ self.assertRaises(socket.gaierror,
+ self.portal.portal_wizard.callRemoteProxyMethod)
+ self.checkLogin(('someone', 'someone'), kw)
+ finally:
+ WizardTool.callRemoteProxyMethod = original_callRemoteProxyMethod
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5RemoteUserManager))
More information about the Erp5-report
mailing list