Commit 85e411bf authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5&cloud: Reuse Person_generatePassword on Tests

   We don't need to generate password everywhere
parent 91e4fb57
Pipeline #11132 passed with stage
in 0 seconds
......@@ -131,7 +131,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
def _addERP5Login(self, document, **kw):
if document.getPortalType() == "Person":
kw["password"] = "%s-aA$1" % self.generateNewId()
kw["password"] = document.Person_generatePassword()
login = document.newContent(
portal_type="ERP5 Login",
reference=document.getReference(),
......
......@@ -183,7 +183,6 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
def test_active(self, login_portal_type="Certificate Login"):
password = '%s-aA1$' % str(random.random())
reference = self._generateRandomUniqueReference('Person')
user_id = self._generateRandomUniqueUserId('Person')
......@@ -192,6 +191,7 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
reference=reference)
person.setUserId(user_id)
password = person.Person_generatePassword()
person.newContent(portal_type='Assignment').open()
if login_portal_type == "ERP5 Login":
person.newContent(portal_type=login_portal_type,
......@@ -235,12 +235,12 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups())
def test_inactive(self, login_portal_type="Certificate Login"):
password = '%s-aA1$' % str(random.random())
reference = self._generateRandomUniqueReference('Person')
user_id = self._generateRandomUniqueReference('Person')
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
password = person.Person_generatePassword()
self.tic()
......
......@@ -100,11 +100,13 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -84,7 +84,7 @@ class TestSlapOSAuthenticationPolicyL(SlapOSTestCaseMixin):
self.assertFalse(login.isLoginBlocked())
# Password should be ignored
login.setPassword("%s-aA$1" % self.generateNewId())
login.setPassword(document.Person_generatePassword())
self._clearCache()
self.tic()
......@@ -197,7 +197,7 @@ class TestSlapOSAuthenticationPolicyL(SlapOSTestCaseMixin):
login_portal_type=login_portal_type
)
login.setPassword("%s-aA$1" % self.generateNewId())
login.setPassword(document.Person_generatePassword())
self.system_preference.setPreferredMaxPasswordLifetimeDuration(0)
self._clearCache()
self.assertTrue(login.isPasswordExpired())
......@@ -208,7 +208,7 @@ class TestSlapOSAuthenticationPolicyL(SlapOSTestCaseMixin):
login_portal_type=login_portal_type
)
login.setPassword("%s-aA$1" % self.generateNewId())
login.setPassword(document.Person_generatePassword())
self.system_preference.setPreferredMaxPasswordLifetimeDuration(0)
self._clearCache()
self.assertFalse(login.isPasswordExpired())
......
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