Commit 47059571 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_credential: move some test code to ease running tests in live

parent ebf856be
...@@ -80,6 +80,13 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -80,6 +80,13 @@ class TestERP5Credential(ERP5TypeTestCase):
system_preference = self.portal.portal_preferences.newContent( system_preference = self.portal.portal_preferences.newContent(
portal_type='System Preference') portal_type='System Preference')
system_preference.enable() system_preference.enable()
# clear modules if necessary
module_list = (self.portal.getDefaultModule('Credential Request'),
self.portal.getDefaultModule('Credential Update'),
self.portal.getDefaultModule('Credential Recovery'),
self.portal.getDefaultModule('Person'))
for module in module_list:
module.manage_delObjects(list(module.objectIds()))
@reindex @reindex
def enableAlarm(self): def enableAlarm(self):
...@@ -140,14 +147,6 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -140,14 +147,6 @@ class TestERP5Credential(ERP5TypeTestCase):
def beforeTearDown(self): def beforeTearDown(self):
self.login() self.login()
self.abort()
# clear modules if necessary
module_list = (self.portal.getDefaultModule('Credential Request'),
self.portal.getDefaultModule('Credential Update'),
self.portal.getDefaultModule('Credential Recovery'),
self.portal.getDefaultModule('Person'))
for module in module_list:
module.manage_delObjects(list(module.objectIds()))
self.resetCredentialSystemPreference() self.resetCredentialSystemPreference()
self.tic() self.tic()
self.logout() self.logout()
...@@ -779,12 +778,15 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -779,12 +778,15 @@ class TestERP5Credential(ERP5TypeTestCase):
for line in body_message.splitlines(): for line in body_message.splitlines():
match_obj = re.search(rawstr, line) match_obj = re.search(rawstr, line)
if match_obj is not None: if match_obj is not None:
url = line[line.find('http:'):] url = line[line.find('http'):]
url = url.strip() url = url.strip()
self.assertNotEquals(url, None) self.assertNotEquals(url, None)
self.publish(url) self.publish(url)
parameters = cgi.parse_qs(urlparse.urlparse(url)[4]) parameters = cgi.parse_qs(urlparse.urlparse(url)[4])
self.assertTrue('reset_key' in parameters) self.assertTrue(
'reset_key' in parameters,
'reset_key not found in mail message : %s' % body_message
)
key = parameters['reset_key'][0] key = parameters['reset_key'][0]
# before changing, check that the user exists with 'secret' password # before changing, check that the user exists with 'secret' password
self._assertUserExists('barney-login', 'secret') self._assertUserExists('barney-login', 'secret')
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testERP5Credential</string> </value> <value> <string>testERP5Credential</string> </value>
...@@ -53,13 +59,28 @@ ...@@ -53,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -72,7 +93,7 @@ ...@@ -72,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -81,7 +102,7 @@ ...@@ -81,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
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