Commit 19b3e1d7 authored by Gabriel Monnerat's avatar Gabriel Monnerat

add test

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44166 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a45c8b47
...@@ -298,6 +298,14 @@ class TestUNG(ERP5TypeTestCase): ...@@ -298,6 +298,14 @@ class TestUNG(ERP5TypeTestCase):
response = json.loads(self.portal.ERPSite_createUNGUser()) response = json.loads(self.portal.ERPSite_createUNGUser())
self.assertEquals(response, None) self.assertEquals(response, None)
def testERP5Site_checkIfUserExistUsingHttpRequest(self):
"""Test script ERP5Site_checkIfUserExist to simulate the browser request"""
script_path = self.portal.web_site_module.ung.getPath() + "/ERP5Site_checkIfUserExist"
response = json.loads(self.publish(script_path).getBody())
self.assertEquals(response, {'response': False})
response = json.loads(self.publish(script_path + "?reference=ung_reference").getBody())
self.assertEquals(response, {'response': True})
def testERP5Site_checkIfUserExist(self): def testERP5Site_checkIfUserExist(self):
"""Test script ERP5Site_checkIfUserExist""" """Test script ERP5Site_checkIfUserExist"""
portal = self.portal portal = self.portal
...@@ -307,13 +315,11 @@ class TestUNG(ERP5TypeTestCase): ...@@ -307,13 +315,11 @@ class TestUNG(ERP5TypeTestCase):
login_name="ung_reference") login_name="ung_reference")
portal.REQUEST.form.update(form_dict) portal.REQUEST.form.update(form_dict)
portal.ERPSite_createUNGUser() portal.ERPSite_createUNGUser()
kw = dict(first_name=form_dict["firstname"], kw = dict(reference=form_dict["login_name"],)
last_name=form_dict["lastname"],
reference=form_dict["login_name"],
)
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEquals(response.get("response"), False) self.assertEquals(response.get("response"), False)
self.stepTic() self.stepTic()
param_list = ["%s=%s" % (key,value) for key, value in kw.iteritems()]
response = json.loads(portal.ERP5Site_checkIfUserExist(**kw)) response = json.loads(portal.ERP5Site_checkIfUserExist(**kw))
self.assertEquals(response.get("response"), True) self.assertEquals(response.get("response"), True)
kw = dict(first_name="Not Exist", kw = dict(first_name="Not Exist",
......
283 284
\ No newline at end of file \ 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