diff --git a/product/ERP5/tests/testAuthenticationPolicy.py b/product/ERP5/tests/testAuthenticationPolicy.py index ca33652665a064c0370c3646f97966065ffe9cd4..a319855b3d82e58daed78b5a1d025f6428e057d2 100644 --- a/product/ERP5/tests/testAuthenticationPolicy.py +++ b/product/ERP5/tests/testAuthenticationPolicy.py @@ -41,10 +41,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase): """ Test for erp5_authentication_policy business template. """ - manager_username = 'zope' - manager_password = 'zope' - - credential = '%s:%s' % (manager_username, manager_password) def getTitle(self): return "TestAuthenticationPolicy" @@ -62,9 +58,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase): def afterSetUp(self): portal = self.getPortal() - uf = portal.acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - self.loginByUserName(self.manager_username) kw = dict(portal_type='Person', reference = 'test') if portal.portal_catalog.getResultValue(**kw) is None: diff --git a/product/ERP5/tests/testAutoLogout.py b/product/ERP5/tests/testAutoLogout.py index 131d7677cc43d42b1c512be201c19face977bc92..9f9666a249d8f197eb50bb5b0a5656c07110b809 100644 --- a/product/ERP5/tests/testAutoLogout.py +++ b/product/ERP5/tests/testAutoLogout.py @@ -36,10 +36,6 @@ class TestAuoLogout(ERP5TypeTestCase): """ Test for erp5_auto_logout business template. """ - manager_username = 'zope' - manager_password = 'zope' - - credential = '%s:%s' % (manager_username, manager_password) def getTitle(self): return "TestAuthenticationPolicy" @@ -53,10 +49,6 @@ class TestAuoLogout(ERP5TypeTestCase): def afterSetUp(self): portal = self.getPortal() - uf = portal.acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - self.loginByUserName(self.manager_username) - # setup short auto-logout period portal.portal_preferences.default_site_preference.setPreferredMaxUserInactivityDuration(5) portal.portal_preferences.default_site_preference.enable() diff --git a/product/ERP5/tests/testERP5Core.py b/product/ERP5/tests/testERP5Core.py index de12fa8f549cda090187b351872a54690a5fe61b..065dc4634bc22f44629615905db6d0e08d53643d 100644 --- a/product/ERP5/tests/testERP5Core.py +++ b/product/ERP5/tests/testERP5Core.py @@ -101,9 +101,6 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): run_all_test = 1 quiet = 1 - manager_username = 'rc' - manager_password = 'w' - def getTitle(self): return "ERP5Core" @@ -112,12 +109,6 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): """ return ('erp5_core_proxy_field_legacy', 'erp5_base', ) - def login(self, quiet=0, run=run_all_test): - uf = self.getPortal().acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - user = uf.getUserById(self.manager_username).__of__(uf) - newSecurityManager(None, user) - def afterSetUp(self): self.login() self.portal_id = self.portal.getId() @@ -519,8 +510,6 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): organisation = self.portal.organisation_module.newContent() person = self.portal.person_module.newContent( default_career_subordination_value=organisation) - for obj in person, organisation: - obj.manage_addLocalRoles(self.manager_username, ['Assignor']) self.commit() self.assertEqual(0, organisation.getRelationCountForDeletion()) self.tic() diff --git a/product/ERP5/tests/testERP5Discussion.py b/product/ERP5/tests/testERP5Discussion.py index 4700942915ae91d39cd4655af1ddeb161ef1b85e..5047eb2152a7208eacaf5ba67c7cba9220e31673 100644 --- a/product/ERP5/tests/testERP5Discussion.py +++ b/product/ERP5/tests/testERP5Discussion.py @@ -38,10 +38,6 @@ from Products.ERP5OOo.tests.testDms import makeFileUpload class TestERP5Discussion(ERP5TypeTestCase): """Test for erp5_discussion business template. """ - - manager_username = 'manager' - manager_password = 'pwd' - def getTitle(self): return "Test ERP5 Discussion" @@ -59,17 +55,6 @@ class TestERP5Discussion(ERP5TypeTestCase): 'erp5_jquery', 'erp5_discussion', ) - def login(self): - uf = self.getPortal().acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - user = uf.getUserById(self.manager_username).__of__(uf) - newSecurityManager(None, user) - - def afterSetUp(self): - self.login() - self.portal_id = self.portal.getId() - self.auth = '%s:%s' % (self.manager_username, self.manager_password) - def beforeTearDown(self): self.abort() for module in (self.portal.discussion_thread_module,): diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py index fd474eece4c54f7bd67a41a87a2628732747630a..75451c352cc0790b0a5c5396bfb7fa9606f8bc0e 100644 --- a/product/ERP5/tests/testERP5Web.py +++ b/product/ERP5/tests/testERP5Web.py @@ -128,10 +128,7 @@ class TestWebSectionTraversalHook(WebTraversalHookTestMixin, ERP5TypeTestCase): class TestERP5Web(ERP5TypeTestCase): """Test for erp5_web business template. """ - manager_username = 'zope' - manager_password = 'zope' website_id = 'test' - credential = '%s:%s' % (manager_username, manager_password) def getTitle(self): return "ERP5Web" @@ -147,17 +144,11 @@ class TestERP5Web(ERP5TypeTestCase): ) def afterSetUp(self): - portal = self.getPortal() - - uf = portal.acl_users - uf._doAddUser(self.manager_username, - self.manager_password, - ['Manager'], []) - self.loginByUserName(self.manager_username) + self.credential = '%s:%s' % (self.manager_username, self.manager_password) self.web_page_module = self.portal.getDefaultModule('Web Page Module') self.web_site_module = self.portal.getDefaultModule('Web Site Module') - portal.Localizer.manage_changeDefaultLang(language='en') + self.portal.Localizer.manage_changeDefaultLang(language='en') self.portal_id = self.portal.getId() def clearModule(self, module): @@ -1355,7 +1346,7 @@ Hé Hé Hé!""", page.asText().strip()) response = self.publish('/%s/%s/%s/%s/Base_editAndEditAsWeb' % \ (self.portal.getId(), website.getRelativeUrl(), language, websection.getId()), - basic='ERP5TypeTestCase:', + basic='%s:%s' % (self.manager_username, self.manager_password), request_method='POST', stdin=StringIO(urlencode({ 'form_id': 'WebSection_view', @@ -1373,7 +1364,9 @@ Hé Hé Hé!""", page.asText().strip()) self.tic() - response = self.publish(new_location, basic='ERP5TypeTestCase:',) + response = self.publish( + new_location, + basic='%s:%s' % (self.manager_username, self.manager_password),) self.assertEqual(HTTP_OK, response.getStatus()) self.assertEqual('text/html; charset=utf-8', response.getHeader('content-type')) @@ -1411,7 +1404,7 @@ Hé Hé Hé!""", page.asText().strip()) response = self.publish('/%s/%s/%s/Base_editAndEditAsWeb' % \ (self.portal.getId(), website.getRelativeUrl(), language), - basic='ERP5TypeTestCase:', + basic='%s:%s' % (self.manager_username, self.manager_password), request_method='POST', stdin=StringIO(urlencode({ 'form_id': 'WebSite_view', @@ -1429,7 +1422,9 @@ Hé Hé Hé!""", page.asText().strip()) self.tic() - response = self.publish(new_location, basic='ERP5TypeTestCase:',) + response = self.publish( + new_location, + basic='%s:%s' % (self.manager_username, self.manager_password),) self.assertEqual(HTTP_OK, response.getStatus()) self.assertEqual('text/html; charset=utf-8', response.getHeader('content-type')) diff --git a/product/ERP5/tests/testERP5WebWithDms.py b/product/ERP5/tests/testERP5WebWithDms.py index 4da38f26cb55101e3861691d4cf15bc837951451..63e1a01fe2b433999b58b80c4522523a8d686dac 100644 --- a/product/ERP5/tests/testERP5WebWithDms.py +++ b/product/ERP5/tests/testERP5WebWithDms.py @@ -115,19 +115,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): """ run_all_test = 1 quiet = 0 - manager_username = 'zope' - manager_password = 'zope' website_id = 'test' def getTitle(self): return "ERP5WebWithDms" - def login(self, quiet=0, run=run_all_test): - uf = self.getPortal().acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - user = uf.getUserById(self.manager_username).__of__(uf) - newSecurityManager(None, user) - def getBusinessTemplateList(self): """ Return the list of required business templates. @@ -549,7 +541,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional): reference=image_reference) image.publish() self.tic() - credential = 'ERP5TypeTestCase:' + credential = '%s:%s' % (self.manager_username, self.manager_password) # testing TextDocument response = self.publish(website.absolute_url_path() + '/' +\ web_page_reference, credential) @@ -699,8 +691,9 @@ return True request = portal.REQUEST request['PARENTS'] = [self.app] + zope_password = self.newPassword() self.getPortalObject().aq_parent.acl_users._doAddUser( - 'zope_user', '', ['Manager',], []) + 'zope_user', zope_password, ['Manager',], []) website = self.setupWebSite() web_section_portal_type = 'Web Section' website.newContent(portal_type=web_section_portal_type) @@ -712,7 +705,10 @@ return True reference=document_reference, file=upload_file) self.tic() - credential_list = ['ERP5TypeTestCase:', 'zope_user:'] + credential_list = [ + '%s:%s' % (self.manager_username, self.manager_password), + 'zope_user:%s' % zope_password, + ] for credential in credential_list: # first, preview the draft in its physical location (in document module) @@ -807,7 +803,7 @@ return True reference=image_reference) image.publish() self.tic() - credential = 'ERP5TypeTestCase:' + credential = '%s:%s' % (self.manager_username, self.manager_password) # testing Image conversions, raw diff --git a/product/ERP5/tests/testEditorField.py b/product/ERP5/tests/testEditorField.py index d352531dab7c32a10df9e9dc6c16ecacf52d8b6d..a938d696b8aa69092e741385d70355d9def4a9a9 100644 --- a/product/ERP5/tests/testEditorField.py +++ b/product/ERP5/tests/testEditorField.py @@ -47,18 +47,10 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional): Please refer to the ERP5 developer howto for more explanation http://www.erp5.org/HowToDisplayOrEditHTML """ - manager_username = 'zope' - manager_password = 'zope' def getTitle(self): return "EditorField" - def login(self): - uf = self.getPortal().acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager', ], []) - user = uf.getUserById(self.manager_username).__of__(uf) - newSecurityManager(None, user) - def getBusinessTemplateList(self): """ Return the list of required business templates. diff --git a/product/ERP5/tests/testExternalAccount.py b/product/ERP5/tests/testExternalAccount.py index 7bf38a2076becc3d79c8db44f6e4ea0ba935fb79..7a55129cec93e5d0a5aedf66e7c05538fc7d55a1 100644 --- a/product/ERP5/tests/testExternalAccount.py +++ b/product/ERP5/tests/testExternalAccount.py @@ -35,10 +35,6 @@ class TestExternalAccount(ERP5TypeTestCase): """ Test for erp5_authentication_policy business template. """ - manager_username = 'zope' - manager_password = 'zope' - - credential = '%s:%s' % (manager_username, manager_password) def getTitle(self): return "TestExternalAccount" @@ -54,10 +50,6 @@ class TestExternalAccount(ERP5TypeTestCase): def afterSetUp(self): portal = self.getPortal() - uf = portal.acl_users - uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) - self.loginByUserName(self.manager_username) - # Setup auth policy preference = portal.portal_preferences.newContent( portal_type = 'System Preference', diff --git a/product/ERP5/tests/testInvalidationBug.py b/product/ERP5/tests/testInvalidationBug.py index 1e754b82794811196934e60cff0efb9c8fb35998..3e74ee9a319d6c1c27e21326fc0c5ec6965b23fb 100644 --- a/product/ERP5/tests/testInvalidationBug.py +++ b/product/ERP5/tests/testInvalidationBug.py @@ -103,8 +103,11 @@ class TestInvalidationBug(ERP5TypeTestCase): ### Prepare unit test, to minimize amount of work during critical section ## url to create some content using another zope - new_content_url = "http://ERP5TypeTestCase:@%s%s/Folder_create" % ( - node_list[0], self.portal.organisation_module.getPath()) + new_content_url = "http://%s:%s@%s%s/Folder_create" % ( + self.manager_username, + self.manager_password, + node_list[0], + self.portal.organisation_module.getPath()) ## prepare freeze/unfreeze of ZEO storage zeo_connection = storage._connection socket_map = zeo_connection._map diff --git a/product/ERP5/tests/testKM.py b/product/ERP5/tests/testKM.py index 1a85c37b713e0bb1287a3129407c48c7872d8ac9..fd8d0bc7a3e3a235aaa2c7eaefa44dca40ca9385 100644 --- a/product/ERP5/tests/testKM.py +++ b/product/ERP5/tests/testKM.py @@ -44,9 +44,6 @@ class TestKMMixIn(TestDocumentMixin): """ Mix in class for Knowledge Management system. """ - - manager_username = 'ivan' - manager_password = '' website_id = 'km_test' business_template_list = ['erp5_core_proxy_field_legacy', 'erp5_full_text_mroonga_catalog','erp5_base', diff --git a/product/ERP5/tests/testWebDavSupport.py b/product/ERP5/tests/testWebDavSupport.py index 57f89ca68bc2125bf11fad2a9ff629f085569c62..9f983541e0c9e3410030a7ddde035bda023af27f 100644 --- a/product/ERP5/tests/testWebDavSupport.py +++ b/product/ERP5/tests/testWebDavSupport.py @@ -53,9 +53,6 @@ def makeFileUpload(name, as_name=None): class TestWebDavSupport(ERP5TypeTestCase): """Test for WEBDAV access. """ - - authentication = 'ERP5TypeTestCase:' - def getTitle(self): return "Test WebDav Support" @@ -71,7 +68,7 @@ class TestWebDavSupport(ERP5TypeTestCase): ) def afterSetUp(self): - portal = self.getPortal() + self.authentication = '%s:%s' % (self.manager_username, self.manager_password) def clearModule(self, module): module.manage_delObjects(list(module.objectIds())) diff --git a/product/ERP5Form/tests/testOOoChart.py b/product/ERP5Form/tests/testOOoChart.py index b84fc8fcf76a29ed06e328f8a0fdb5198fa3f477..edda7930f545aa5518c8a7b4d3ffb0c77442be97 100644 --- a/product/ERP5Form/tests/testOOoChart.py +++ b/product/ERP5Form/tests/testOOoChart.py @@ -62,7 +62,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): 'erp5_ods_style') def afterSetUp(self): - self.auth = 'ERP5TypeTestCase:' + self.auth = '%s:%s' % (self.manager_username, self.manager_password) portal = self.getPortal() container = portal.portal_skins.custom if self.form_id not in container.objectIds(): diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py index 951b78425fdcce85b084d5df9436f178979184c3..fa638891c6cfafafbec5a60596dc79c17af16ce9 100644 --- a/product/ERP5OOo/tests/testDms.py +++ b/product/ERP5OOo/tests/testDms.py @@ -48,6 +48,7 @@ import unittest import time import StringIO +import base64 from subprocess import Popen, PIPE from cgi import FieldStorage from unittest import expectedFailure @@ -226,8 +227,8 @@ class TestDocument(TestDocumentMixin): return (width, height) def getURLSizeList(self, uri, **kw): - # __ac=RVJQNVR5cGVUZXN0Q2FzZTo%3D is encoded ERP5TypeTestCase with empty password - url = '%s?%s&__ac=%s' %(uri, make_query(kw), 'RVJQNVR5cGVUZXN0Q2FzZTo%3D') + kw['__ac'] = base64.b64encode('%s:%s' % (self.manager_username, self.manager_password)) + url = '%s?%s' % (uri, make_query(kw)) format=kw.get('format', 'jpeg') infile = urllib.urlopen(url) # save as file with proper incl. format filename (for some reasons PIL uses this info) @@ -1120,7 +1121,7 @@ class TestDocument(TestDocumentMixin): self.tic() # login as another user - super(TestDocument, self).loginByUserName('user1') + self.loginByUserName('user1') document_4 = portal.document_module.newContent( portal_type = 'Presentation', description = 'owner different user contributing document', @@ -1203,7 +1204,7 @@ class TestDocument(TestDocumentMixin): self.assertSameSet([], getAdvancedSearchStringResultList(**kw)) # only my docs - super(TestDocument, self).loginByUserName('user1') + self.loginByUserName('user1') kw = {'searchabletext_any': 'owner'} # should return all documents matching a word no matter if we're owner or not self.assertSameSet([web_page_1, document_4], getAdvancedSearchStringResultList(**kw)) @@ -1675,7 +1676,7 @@ class TestDocument(TestDocumentMixin): self.tic() # login as first one - super(TestDocument, self).loginByUserName('contributor1') + self.loginByUserName('contributor1') doc = document_module.newContent(portal_type='File', title='Test1') self.tic() @@ -1684,7 +1685,7 @@ class TestDocument(TestDocumentMixin): doc.getContributorValueList()) # login as second one - super(TestDocument, self).loginByUserName('contributor2') + self.loginByUserName('contributor2') doc.edit(title='Test2') self.tic() self.login() @@ -1944,8 +1945,7 @@ document.write('