Commit 581f7c7b authored by Ivan Tyagov's avatar Ivan Tyagov

Clean up test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42617 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc6deb80
...@@ -120,16 +120,14 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -120,16 +120,14 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.getPortal().portal_skins.changeSkin(skin_name) self.getPortal().portal_skins.changeSkin(skin_name)
request.set('portal_skin', skin_name) request.set('portal_skin', skin_name)
def test_01ProperPoolInitialization(self, quiet=quiet, run=run_all_test): def test_01ProperPoolInitialization(self):
""" Check that it's properly initialized """ """ Check that it's properly initialized """
if not run: return
portal = self.getPortal() portal = self.getPortal()
self.assertNotEqual(None, self.assertNotEqual(None,
getattr(portal, 'portal_gadgets', None)) getattr(portal, 'portal_gadgets', None))
def test_02(self, quiet=quiet, run=run_all_test): def test_02(self):
""" Check Gadgets """ """ Check Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
knowledge_pad_module = getattr(portal, 'knowledge_pad_module') knowledge_pad_module = getattr(portal, 'knowledge_pad_module')
# remove created by login method pads # remove created by login method pads
...@@ -214,42 +212,31 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -214,42 +212,31 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
mode='web_section', mode='web_section',
default_pad_group = pad_group) default_pad_group = pad_group)
self.stepTic() self.stepTic()
websection_pads = websection.ERP5Site_getKnowledgePadListForUser( #websection_pads = websection.ERP5Site_getKnowledgePadListForUser(
mode='web_section', #mode='web_section',
default_pad_group = pad_group) #default_pad_group = pad_group)
base_websection_pad, websection_pads = \ base_websection_pad, websection_pads = \
websection.ERP5Site_getActiveKnowledgePadForUser(websection_pads, websection.ERP5Site_getActiveKnowledgePadForUser(default_pad_group = pad_group)
default_pad_group = pad_group)
# Check stick # Check stick
websection.WebSection_stickKnowledgePad( websection.WebSection_stickKnowledgePad(
base_websection_pad.getRelativeUrl(), '') base_websection_pad.getRelativeUrl(), '')
self.stepTic() self.stepTic()
websection_pads = websection.ERP5Site_getKnowledgePadListForUser(
mode='web_section',
default_pad_group = pad_group)
current_websection_pad, websection_pads = \ current_websection_pad, websection_pads = \
websection.ERP5Site_getActiveKnowledgePadForUser(websection_pads, websection.ERP5Site_getActiveKnowledgePadForUser(mode='web_section',
mode='web_section',
default_pad_group = pad_group ) default_pad_group = pad_group )
self.assertNotEqual(base_websection_pad.getObject(), self.assertNotEqual(base_websection_pad.getObject(),
current_websection_pad.getObject()) current_websection_pad.getObject())
# check unstick # check unstick
websection.WebSection_unStickKnowledgePad(current_websection_pad.getRelativeUrl(), '') websection.WebSection_unStickKnowledgePad(current_websection_pad.getRelativeUrl(), '')
websection_pads = websection.ERP5Site_getKnowledgePadListForUser(
mode='web_section',
default_pad_group = pad_group)
current_websection_pad, websection_pads = \ current_websection_pad, websection_pads = \
websection.ERP5Site_getActiveKnowledgePadForUser(websection_pads, websection.ERP5Site_getActiveKnowledgePadForUser(default_pad_group = pad_group)
default_pad_group = pad_group)
self.assertEqual(base_websection_pad.getObject(), self.assertEqual(base_websection_pad.getObject(),
current_websection_pad.getObject()) current_websection_pad.getObject())
def test_03DefaultKnowledgePadFromPreference(self, quiet=quiet, run=run_all_test): def test_03DefaultKnowledgePadFromPreference(self):
""" Check Gadgets """ """ Check Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
website = self.website website = self.website
websection = self.websection websection = self.websection
...@@ -419,9 +406,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -419,9 +406,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertEqual("visible", self.assertEqual("visible",
websection_content_knowledge_pad.objectValues()[0].getValidationState()) websection_content_knowledge_pad.objectValues()[0].getValidationState())
def test_04WebFrontGadgets(self, quiet=quiet, run=run_all_test): def test_04WebFrontGadgets(self):
""" Check different Web / KM Gadgets """ """ Check different Web / KM Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
...@@ -448,9 +434,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -448,9 +434,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
for gadget in web_front_gadgets: for gadget in web_front_gadgets:
self.failUnless(gadget.getTitle() in response.getBody()) self.failUnless(gadget.getTitle() in response.getBody())
def test_05MyTaskGadget(self, quiet=quiet, run=run_all_test): def test_05MyTaskGadget(self):
""" Check My Task Gadgets """ """ Check My Task Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
km_my_tasks_gadget = portal.portal_gadgets.km_my_tasks km_my_tasks_gadget = portal.portal_gadgets.km_my_tasks
...@@ -488,9 +473,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -488,9 +473,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.failUnless(project.getTitle() in response.getBody()) self.failUnless(project.getTitle() in response.getBody())
self.failUnless(visit.getTitle() in response.getBody()) self.failUnless(visit.getTitle() in response.getBody())
def test_06MyDocumentsGadget(self, quiet=quiet, run=run_all_test): def test_06MyDocumentsGadget(self):
""" Check My Document Gadgets """ """ Check My Document Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
km_my_documents_gadget = portal.portal_gadgets.km_my_documents km_my_documents_gadget = portal.portal_gadgets.km_my_documents
...@@ -532,9 +516,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -532,9 +516,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.failUnless(web_page.getTitle() in response.getBody()) self.failUnless(web_page.getTitle() in response.getBody())
self.failUnless(presentation.getTitle() in response.getBody()) self.failUnless(presentation.getTitle() in response.getBody())
def test_07MyContactsGadget(self, quiet=quiet, run=run_all_test): def test_07MyContactsGadget(self):
""" Check My Contacts Gadgets """ """ Check My Contacts Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
km_my_contacts_gadget = portal.portal_gadgets.km_my_contacts km_my_contacts_gadget = portal.portal_gadgets.km_my_contacts
...@@ -569,9 +552,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -569,9 +552,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
, self.auth)]: , self.auth)]:
self.failUnless(person.getTitle() in response.getBody()) self.failUnless(person.getTitle() in response.getBody())
def test_08WebSectionGadget(self, quiet=quiet, run=run_all_test): def test_08WebSectionGadget(self):
""" Check Web Section Gadgets """ """ Check Web Section Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
km_subsection_gadget = portal.portal_gadgets.km_subsection km_subsection_gadget = portal.portal_gadgets.km_subsection
km_latest_documents_gadget = portal.portal_gadgets.km_latest_documents km_latest_documents_gadget = portal.portal_gadgets.km_latest_documents
...@@ -591,9 +573,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -591,9 +573,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
for gadget in web_section_gadgets: for gadget in web_section_gadgets:
self.failUnless(gadget.getTitle() in response.getBody()) self.failUnless(gadget.getTitle() in response.getBody())
def test_10LatestContentGadget(self, quiet=quiet, run=run_all_test): def test_10LatestContentGadget(self):
""" Check Latest Content Gadgets """ """ Check Latest Content Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
km_latest_documents_gadget = portal.portal_gadgets.km_latest_documents km_latest_documents_gadget = portal.portal_gadgets.km_latest_documents
...@@ -639,9 +620,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -639,9 +620,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
km_latest_documents_gadget_box_url) km_latest_documents_gadget_box_url)
, self.auth).getBody()) , self.auth).getBody())
def test_11AssignedMembersGadget(self, quiet=quiet, run=run_all_test): def test_11AssignedMembersGadget(self):
""" Check Assigned Members Gadgets """ """ Check Assigned Members Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
km_assigned_member_gadget = portal.portal_gadgets.km_assigned_member km_assigned_member_gadget = portal.portal_gadgets.km_assigned_member
...@@ -690,9 +670,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -690,9 +670,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
km_assigned_member_gadget_box_url) km_assigned_member_gadget_box_url)
, self.auth).getBody()) , self.auth).getBody())
def test_11WebSectionContentGadget(self, quiet=quiet, run=run_all_test): def test_11WebSectionContentGadget(self):
""" Check Web Section Content Gadgets """ """ Check Web Section Content Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
...@@ -707,11 +686,9 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -707,11 +686,9 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
for gadget in web_section_content_gadgets: for gadget in web_section_content_gadgets:
self.failUnless(gadget.getTitle() in response.getBody()) self.failUnless(gadget.getTitle() in response.getBody())
return
def test_12RelationGadget(self, quiet=quiet, run=run_all_test): def test_12RelationGadget(self):
""" Check Relation Gadgets """ """ Check Relation Gadgets """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
km_document_relations_gadget = portal.portal_gadgets.km_document_relations km_document_relations_gadget = portal.portal_gadgets.km_document_relations
...@@ -763,12 +740,11 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -763,12 +740,11 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.failUnless(predecessor_doc.getTitle() in relation_form_renderer()) self.failUnless(predecessor_doc.getTitle() in relation_form_renderer())
self.failUnless(successor_doc.getTitle() in relation_form_renderer()) self.failUnless(successor_doc.getTitle() in relation_form_renderer())
def test_15GadgetServerSideFailure(self, quiet=quiet, run=run_all_test): def test_15GadgetServerSideFailure(self):
""" """
Check that if gadget uses a non existent view / edit form Check that if gadget uses a non existent view / edit form
nothing is raised but a message is shown to user. nothing is raised but a message is shown to user.
""" """
if not run: return
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
portal_gadgets = portal.portal_gadgets portal_gadgets = portal.portal_gadgets
...@@ -803,11 +779,10 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -803,11 +779,10 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
response = self.publish(url, self.auth) response = self.publish(url, self.auth)
self.failUnless('Server side error' not in response.getBody()) self.failUnless('Server side error' not in response.getBody())
def test_16WebSiteBrowserGadget(self, quiet=quiet, run=run_all_test): def test_16WebSiteBrowserGadget(self):
""" """
Check Web Site Browser Gadget. Check Web Site Browser Gadget.
""" """
if not run: return
portal = self.getPortal() portal = self.getPortal()
web_site_browser_gadget = portal.portal_gadgets.web_site_browser web_site_browser_gadget = portal.portal_gadgets.web_site_browser
...@@ -841,9 +816,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -841,9 +816,8 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.failUnless(subsection.getTitle() in self.failUnless(subsection.getTitle() in
self.publish(url, self.auth).getBody()) self.publish(url, self.auth).getBody())
def test_17AddGadgets(self, quiet=quiet, run=run_all_test): def test_17AddGadgets(self):
""" Check Latest Content Gadgets """ """ Check Latest Content Gadgets """
portal = self.getPortal() portal = self.getPortal()
portal_selections = portal.portal_selections portal_selections = portal.portal_selections
km_my_documents_gadget = portal.portal_gadgets.km_my_documents km_my_documents_gadget = portal.portal_gadgets.km_my_documents
...@@ -871,7 +845,6 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -871,7 +845,6 @@ class TestGadgets(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertSameSet([km_my_documents_gadget, km_my_contacts_gadget], self.assertSameSet([km_my_documents_gadget, km_my_contacts_gadget],
[x.getSpecialiseValue() for x in self.web_front_knowledge_pad.objectValues()]) [x.getSpecialiseValue() for x in self.web_front_knowledge_pad.objectValues()])
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestGadgets)) suite.addTest(unittest.makeSuite(TestGadgets))
......
1739 1740
\ 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