Commit a45c8b47 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor and rename python script

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44165 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eaf3972b
......@@ -52,10 +52,16 @@
<key> <string>_body</string> </key>
<value> <string>import json\n
\n
kw.update(context.REQUEST.form)\n
\n
if not kw:\n
return json.dumps(dict(response=False))\n
\n
portal = context.getPortalObject()\n
person = portal.portal_catalog.getResultValue(portal_type="Person",\n
validation_state="validated",\n
**kw)\n
\n
return json.dumps(dict(response=(person is not None)))\n
</string> </value>
</item>
......@@ -73,7 +79,7 @@ return json.dumps(dict(response=(person is not None)))\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUserValidationState</string> </value>
<value> <string>ERP5Site_checkIfUserExist</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -136,7 +136,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.getModificationDate()</string> </value>
<value> <string>cell/getModificationDate</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -114,14 +114,14 @@ function changeCheckBoxValue(value){\n
}\n
\n
function waitCreateUNGUser(paramStr){\n
$.get("ERP5Site_getUserValidationState?" + paramStr, {}, function(data, textStatus, XMLHttpRequest){\n
$.get("ERP5Site_checkIfUserExist?" + paramStr, {}, function(data, textStatus, xhr){\n
data = jQuery.parseJSON(data);\n
if (data.response == true){\n
clearTimeout();\n
window.location.reload();\n
}\n
else {\n
setTimeout(waitCreateUNGUser(paramStr), 2000);\n
setTimeout(waitCreateUNGUser(paramStr), 3500);\n
}\n
});\n
}\n
......@@ -160,8 +160,7 @@ function displayLoginForm(){ \n
return false;\n
}\n
else {\n
var paramStr = "first_name=" + formHash.firstname +\n
"&" + "last_name=" + formHash.lastname;\n
var paramStr = "reference=" + formHash.login_name;\n
setTimeout(waitCreateUNGUser(paramStr), 2000); \n
}\n
});\n
......
......@@ -298,8 +298,8 @@ class TestUNG(ERP5TypeTestCase):
response = json.loads(self.portal.ERPSite_createUNGUser())
self.assertEquals(response, None)
def testERP5Site_getUserValidationState(self):
"""Test script ERP5Site_getUserValidationState"""
def testERP5Site_checkIfUserExist(self):
"""Test script ERP5Site_checkIfUserExist"""
portal = self.portal
form_dict = dict(firstname="UNG",
lastname="User",
......@@ -311,15 +311,15 @@ class TestUNG(ERP5TypeTestCase):
last_name=form_dict["lastname"],
reference=form_dict["login_name"],
)
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEquals(response.get("response"), False)
self.stepTic()
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEquals(response.get("response"), True)
kw = dict(first_name="Not Exist",
reference="no_reference",
)
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEquals(response.get("response"), False)
self.login("ung_reference")
user = portal.ERP5Site_getAuthenticatedMemberPersonValue()
......
282
\ No newline at end of file
283
\ 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