Commit f740134b authored by Gabriel Monnerat's avatar Gabriel Monnerat

add new test validate the script ERP5Site_getUserValidationState

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43954 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5ee3a424
...@@ -69,6 +69,10 @@ class TestUNG(ERP5TypeTestCase): ...@@ -69,6 +69,10 @@ class TestUNG(ERP5TypeTestCase):
'erp5_web_ung_core', 'erp5_web_ung_core',
'erp5_web_ung_theme',) 'erp5_web_ung_theme',)
def afterSetUp(self):
"""Clean up form"""
self.portal.REQUEST.form.clear()
def assertCreateDocumentUsingTemplate(self, template, **kw): def assertCreateDocumentUsingTemplate(self, template, **kw):
web_page_module = self.portal.web_page_module web_page_module = self.portal.web_page_module
self.portal.ERP5Site_createNewWebDocument(template) self.portal.ERP5Site_createNewWebDocument(template)
...@@ -288,4 +292,27 @@ class TestUNG(ERP5TypeTestCase): ...@@ -288,4 +292,27 @@ class TestUNG(ERP5TypeTestCase):
self.assertEquals(person.getLastName(), "User") self.assertEquals(person.getLastName(), "User")
self.assertEquals(person.getValidationState(), "validated") self.assertEquals(person.getValidationState(), "validated")
self.assertEquals(person.getEmail().getPortalType(), "Email") self.assertEquals(person.getEmail().getPortalType(), "Email")
self.assertEquals(person.getEmailText(), "g@g.com") self.assertEquals(person.getEmailText(), "g@g.com")
\ No newline at end of file
def testERP5Site_getUserValidationState(self):
"""Test script ERP5Site_getUserValidationState"""
portal = self.portal
form_dict = dict(firstname="UNG",
lastname="User",
email="g@g.com",
reference="ung_reference")
portal.REQUEST.form.update(form_dict)
portal.ERPSite_createUNGUser()
kw = dict(first_name=form_dict["firstname"],
last_name=form_dict["lastname"],
)
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
self.assertEquals(response.get("response"), False)
self.stepTic()
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
self.assertEquals(response.get("response"), True)
kw = dict(first_name="Not Exist",
reference="no_reference",
)
response = json.loads(portal.ERP5Site_getUserValidationState(**kw))
self.assertEquals(response.get("response"), False)
\ No newline at end of file
270 271
\ 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