Commit 2283bf10 authored by Łukasz Nowak's avatar Łukasz Nowak

- separate tests totally by recreating all before and after test run


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39147 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d11282d
...@@ -101,6 +101,8 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase): ...@@ -101,6 +101,8 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase):
def afterSetUp(self): def afterSetUp(self):
self.portal = self.getPortalObject() self.portal = self.getPortalObject()
self.createDummyWitchTool()
self.setUpRemoteUserManager()
self.person_module = self.portal.person_module self.person_module = self.portal.person_module
acl_users = self.portal.acl_users acl_users = self.portal.acl_users
self.erp5_remote_manager = getattr(acl_users, self.erp5_remote_manager_id) self.erp5_remote_manager = getattr(acl_users, self.erp5_remote_manager_id)
...@@ -111,6 +113,10 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase): ...@@ -111,6 +113,10 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase):
self.tic() self.tic()
def beforeTearDown(self): def beforeTearDown(self):
"""Clear everthing"""
self.portal.acl_users.manage_delObjects(self.erp5_remote_manager_id)
self.portal.deleteContent('portal_witch')
self.removeAuthenticationServerPreferences()
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -118,25 +124,26 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase): ...@@ -118,25 +124,26 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase):
transaction.commit() transaction.commit()
self.tic() self.tic()
def setUpAuthenticationServerPreferences(self): def removeAuthenticationServerPreferences(self):
portal_preferences = self.portal.portal_preferences portal_preferences = self.portal.portal_preferences
# disable all existing system preferences
system_preference = None
if self.system_preference_id in portal_preferences.objectIds(): if self.system_preference_id in portal_preferences.objectIds():
system_preference = getattr(portal_preferences, portal_preferences.deleteContent(self.system_preference_id)
self.system_preference_id)
self.assertEqual(self.system_preference_portal_type, def setUpAuthenticationServerPreferences(self, server_url=None,
system_preference.getPortalType()) server_root=None):
else: if server_url is None:
system_preference = portal_preferences.newContent( server_url = self.portal.absolute_url() + '/'
portal_type=self.system_preference_portal_type) if server_root is None:
system_preference.edit( self.getPortalId()
preferred_witch_tool_server_url=self.portal.absolute_url() + '/', portal_preferences = self.portal.portal_preferences
preferred_witch_tool_server_root=self.getPortalId(), # disable all existing system preferences
system_preference = portal_preferences.newContent(
portal_type=self.system_preference_portal_type,
id=self.system_preference_id,
preferred_witch_tool_server_url=server_url,
preferred_witch_tool_server_root=server_root,
) )
if self.portal.portal_workflow.isTransitionPossible(system_preference, system_preference.enable()
'enable'):
system_preference.enable()
self.assertEqual('global', system_preference.getPreferenceState()) self.assertEqual('global', system_preference.getPreferenceState())
# clear cache after setting preferences # clear cache after setting preferences
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
...@@ -146,13 +153,6 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase): ...@@ -146,13 +153,6 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase):
self.portal.newContent(id='portal_witch', self.portal.newContent(id='portal_witch',
portal_type=self.base_type_portal_type) portal_type=self.base_type_portal_type)
def setUpOnce(self):
self.portal = self.getPortalObject()
self.setUpRemoteUserManager()
self.createDummyWitchTool()
transaction.commit()
self.tic()
def createPerson(self, reference, password): def createPerson(self, reference, password):
"""Creates person with reference and password in title to simulate remote """Creates person with reference and password in title to simulate remote
logging""" logging"""
...@@ -160,6 +160,9 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase): ...@@ -160,6 +160,9 @@ class TestERP5RemoteUserManager(ERP5TypeTestCase):
portal_type=self.person_portal_type, portal_type=self.person_portal_type,
reference=reference, title=password) reference=reference, title=password)
############################################################################
# TESTS
############################################################################
def test_correct_login(self): def test_correct_login(self):
login = 'someone' login = 'someone'
password = 'somepass' password = 'somepass'
......
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