Commit 01a024a5 authored by Gabriel Monnerat's avatar Gabriel Monnerat

- Add tests to UNG Docs.

- clean up the code

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43829 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a4bc0cfe
......@@ -53,12 +53,10 @@
<value> <string>from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
\n
if context.portal_membership.isAnonymousUser():\n
print None\n
return dumps(None)\n
portal_preferences = context.portal_preferences\n
print dumps(dict(preference=portal_preferences.getActivePreference().getRelativeUrl(), \n
return dumps(dict(preference=portal_preferences.getActivePreference().getRelativeUrl(), \n
system_preference=portal_preferences.getActiveSystemPreference().getRelativeUrl()))\n
\n
return printed\n
</string> </value>
</item>
<item>
......
......@@ -144,3 +144,40 @@ class TestUNG(ERP5TypeTestCase):
self.portal.WebSection_deleteObjectList()
self.stepTic()
self.assertEquals(len(self.portal.portal_catalog(relative_url=relative_url)), 0)
def testWebSection_userFollowUpWebPage(self):
""" """
web_page = self.portal.web_page_module.newContent(portal_type="Web Page")
web_page.setReference("new.Web-Page")
self.stepTic()
portal = self.portal
person = portal.person_module.newContent(portal_type='Person',
reference="ung_new_user")
assignment = person.newContent(portal_type='Assignment')
assignment.open()
person = portal.person_module.newContent(portal_type='Person',
reference="ung_new_user2")
assignment = person.newContent(portal_type='Assignment')
assignment.open()
self.stepTic()
self.login("ung_new_user")
self.portal.WebSection_userFollowUpWebPage("new.Web-Page")
self.stepTic()
self.assertEquals(["person_module/1"], web_page.getFollowUpList())
self.stepTic()
self.login("ung_new_user2")
self.portal.WebSection_userFollowUpWebPage("new.Web-Page")
self.stepTic()
followup_list = web_page.getFollowUpList()
self.assertEquals(["person_module/1", "person_module/2"],
sorted(followup_list))
def testWebSection_getGadgetPathList(self):
""" """
gadget_list = eval(self.portal.WebSection_getGadgetPathList())
for gadget in gadget_list:
url = gadget.get("image_url").split("?")[0]
url = url.replace("/default_image", "")
catalog_result = self.portal.portal_catalog(relative_url=url)
self.assertEquals(len(catalog_result), 1)
self.assertEquals(catalog_result[0].getTitle(), gadget.get('title'))
\ No newline at end of file
254
\ No newline at end of file
255
\ 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