source: products/qPingTool/branches/plone-3.1/tests/testSetup.py

Last change on this file was 208, checked in by mylan, 18 years ago
  • Separate templates for *discussion manager* (for approve comment) and for *creator* (that comment added and published)
  • Add "Enable Document Owner notification on new comments." and replaced old "Enable e-mail notification on new coments." with "Enable Discussion Manager notification on new comments."

for 2.0.5 Plone release

File size: 2.7 KB
Line 
1#
2# testSetup
3#
4
5from base import *
6from config import skins_content, istalled_types, types_actions
7
8class TestSetup(TestCase):
9
10    def afterSetUp(self):
11        self.loginAsPortalOwner()
12        self.qi = getattr(self.portal.aq_explicit, 'portal_quickinstaller')
13        self.ttool = getattr(self.portal.aq_explicit, 'portal_types')
14        self.ptool =  getattr(self.portal.aq_explicit, 'portal_properties')
15
16    def test_installed_products(self):
17        qi = self.qi
18        installed = [ prod['id'] for prod in qi.listInstalledProducts() ]
19        self.failUnless('qPingTool' in installed, installed)
20        self.failUnless('Quills' in installed, installed)
21
22    def test_tool_installed(self):
23        t = getToolByName(self.portal, 'portal_pingtool', None)
24        self.failUnless(t, t)
25        self.failUnless(isinstance(t, PingTool.PingTool), t.__class__)
26        self.failUnlessEqual(t.meta_type, 'PingTool')
27        self.failUnlessEqual(t.getId(), 'portal_pingtool')
28
29    def test_skin_installed(self):
30        stool = getattr(self.portal.aq_explicit, 'portal_skins')
31        ids = stool.objectIds()
32        self.failUnless('qpingtool' in ids, ids)
33        content = [i.id for i in self.portal.portal_skins.qpingtool.objectValues()]
34        content.sort()
35        skins_content.sort()
36        self.failUnless(content==skins_content)
37
38    def test_installedAllTypes(self):
39        # test that all types are installed well
40        ttool = self.ttool
41        tids = ttool.objectIds()
42        for id in istalled_types:
43            self.failUnless(id in tids, (id, tids))
44            tinfo = ttool[id]
45            self.failUnless(tinfo.product == 'qPingTool', tinfo.product)
46
47    def test_added_action(self):
48        t = getToolByName(self.portal, 'portal_pingtool', None)
49        ttool = self.ttool
50        for type_actions in types_actions:
51            pttool = ttool[type_actions['type']]
52            for id, name, action, permission, category, visible in type_actions['actions']:
53                pt_actions_ids = [a.getId() for a in pttool.listActions()]
54                pt_action = [a for a in pttool.listActions() if a.id == id][0]
55                self.failUnless(id in pt_actions_ids, pt_actions_ids)
56                self.failUnless(name == pt_action.Title(), pt_action)
57                self.failUnless(action == pt_action.getActionExpression(), pt_action)
58                self.failUnless(permission == pt_action.getPermissions(), pt_action)
59                self.failUnless(category == pt_action.getCategory(), pt_action)
60                self.failUnless(visible == pt_action.getVisibility(), pt_action)
61
62
63def test_suite():
64    from unittest import TestSuite, makeSuite
65    suite = TestSuite()
66    suite.addTest(makeSuite(TestSetup))
67    return suite
Note: See TracBrowser for help on using the repository browser.