Commit 62f832b4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_authentication_policy: Migrate Unit Test.

parent 5dc3a8b0
......@@ -35,7 +35,6 @@ from StringIO import StringIO
import time
import httplib
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.Formulator.Errors import ValidationError
from Products.ERP5Type.Document import newTempBase
class TestAuthenticationPolicy(ERP5TypeTestCase):
......@@ -125,7 +124,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
"""
if person_kw is None:
person_kw = {}
self.createUser
person = self.portal.person_module.newContent(
portal_type='Person', **person_kw)
login = person.newContent(portal_type='ERP5 Login',
......@@ -284,7 +282,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
Test validity of a password.
"""
portal = self.getPortal()
request = self.app.REQUEST
regular_expression_list = ['([a-z]+)', # english lowercase
'([A-Z]+)', # english uppercase
......@@ -607,7 +604,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
Test automatic system recover password
"""
portal = self.portal
request = self.app.REQUEST
self.assertTrue(portal.portal_preferences.isAuthenticationPolicyEnabled())
preference = portal.portal_catalog.getResultValue(portal_type = 'System Preference',
......@@ -635,7 +631,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
)
# User cannot login
# fire 5 requests, only 1 credential recovery should be created
for i in range(5):
for _ in range(5):
response = publish()
self.assertTrue(response.getHeader("Location").endswith("login_form"))
self.tic()
......@@ -663,7 +659,6 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
Check HTTP responses
"""
portal = self.getPortal()
request = self.app.REQUEST
preference = portal.portal_catalog.getResultValue(portal_type = 'System Preference',
title = 'Authentication',)
......@@ -786,7 +781,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
password='current',
person_kw={'first_name': 'Alice'})
person.newContent(portal_type = 'Assignment').open()
login = person.objectValues(portal_type='ERP5 Login')[0]
self.assertEqual(len(person.objectValues(portal_type='ERP5 Login')), 1)
preference = self.portal.portal_catalog.getResultValue(
portal_type='System Preference',
title='Authentication',)
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testAuthenticationPolicy</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testAuthenticationPolicy</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testAuthenticationPolicy</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testAuthenticationPolicy
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_base
erp5_web
erp5_crm
\ No newline at end of file
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