Commit 6a22a891 authored by Gabriel Monnerat's avatar Gabriel Monnerat

- add new test and refactor the script to change state of object when it is invisible

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44138 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb8a66e8
......@@ -57,8 +57,11 @@ knowledge_pad = portal_catalog.getResultValue(portal_type="Knowledge Pad",\n
validation_state=["visible", "public"])\n
\n
knowledge_box = knowledge_pad.newContent(portal_type="Knowledge Box")\n
\n
knowledge_box.setSpecialise("portal_gadgets/%s" % gadget_id)\n
gadget_relative_url = "portal_gadgets/%s" % gadget_id\n
gadget = portal_catalog.getResultValue(portal_type="Gadget", id=gadget_id)\n
if gadget.getValidationState() == "invisible":\n
gadget.visible()\n
knowledge_box.setSpecialise(gadget_relative_url)\n
knowledge_box.visible()\n
</string> </value>
</item>
......
......@@ -324,3 +324,16 @@ class TestUNG(ERP5TypeTestCase):
self.login("ung_reference")
user = portal.ERP5Site_getAuthenticatedMemberPersonValue()
self.assertEquals(user.getFirstName(), "UNG")
def testWebSection_addGadget(self):
"""Test if gadgets are added correctly"""
obj = self.portal.knowledge_pad_module.newContent(portal_type="Knowledge Pad")
obj.visible()
self.stepTic()
gadget = self.portal.portal_gadgets.searchFolder()[0]
gadget_id = gadget.getId()
self.portal.web_site_module.ung.WebSection_addGadget(gadget_id)
self.stepTic()
gadget = self.portal.portal_catalog.getResultValue(portal_type="Gadget",
validation_state="visible")
self.assertEquals(gadget_id, gadget.getId())
\ No newline at end of file
279
\ No newline at end of file
280
\ 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