source: trunk/tests/testCustomization.py @ 1326

Revision 1326, 5.4 KB checked in by pjotr, 13 years ago (diff)

Forgot one thing

  • Property svn:eol-style set to native
Line 
1# Copyright 2006 by the LeMill Team (see AUTHORS)
2#
3# This file is part of LeMill.
4#
5# LeMill is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# LeMill is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with LeMill; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19import os, sys, re
20if __name__ == '__main__':
21    execfile(os.path.join(sys.path[0], 'framework.py'))
22
23from Testing import ZopeTestCase
24from LeMillTestCase import LeMillTestCase
25from Testing.ZopeTestCase.functional import Functional
26from Products.CMFCore.utils import getToolByName
27
28
29from Products.LeMill.ConfigurationMethods import LeMillSetup
30from Products.LeMill.config import *
31from Products.PloneTestCase.setup import portal_owner, default_password
32
33auth = ':'.join((portal_owner, default_password))
34
35
36class TestCustomization(LeMillTestCase,Functional):
37    """
38    Test suite for verifying customization policy.
39    """
40
41    def testSkinExistence(self):
42        for SKIN_NAME in SKIN_NAMES:
43            self.failUnless(SKIN_NAME in self.portal.portal_skins.getSkinSelections(),"Our skin '%s' not found" % SKIN_NAME)
44
45    def testTopics(self):
46        path=self.portal.content.absolute_url_path()
47        result=self.publish(path).getBody()
48        self.failUnless(re.search('By language', result),"The link 'By language' is not there.")
49        path=self.portal.content.language.absolute_url_path()
50        result=self.publish(path).getStatus()
51        self.failUnless(result==200 or result==302, "Loading topic page 'language' failed, status="+str(result))
52
53    def testSyndication(self):
54        self.failUnless(self.portal.portal_syndication.isAllowed,"Syndication isn't turned on.")
55
56    def testPortletLayout(self):
57        for entry in self.portal.right_slots:
58            self.failIf('calendar' in entry,'Calendar portlet is still visible')
59        for entry in self.portal.left_slots:
60            self.failIf('recent' in entry,'Recent changes portlet is still visible: %s' % str(self.portal.left_slots))
61
62    def testNoNavTree(self):
63        for entry in self.portal.left_slots:
64            self.failIf('navigation' in entry,'Navigation portlet is still visible')
65        for entry in self.portal.right_slots:
66            self.failIf('navigation' in entry,'Navigation portlet is still visible')
67
68    def testTopTabs(self):
69        for action in self.portal.portal_actions._actions:
70            if action.getCategory()=='portal_tabs' and action.getVisibility()==True:
71                self.failUnless(action.Title() in SECTIONS,
72                                'Visible tabs found that are not in SECTIONS: %s' % action.Title())
73   
74    def testSetupFolders(self):
75        self.loginAsPortalOwner()
76        pm=getToolByName(self.portal, 'portal_migration')
77        pm.installItems(LeMillSetup.type,["setupFolders",])
78        pa=getToolByName(self.portal, 'portal_actions')
79        acts = pa._cloneActions()
80        target=SECTIONS[0]
81        counter = 0
82        for action in acts:
83            if action.category == 'portal_tabs' and action.title == target:
84                counter+=1
85        self.failIf(counter != 1, 'Too many portal tabs.')
86
87    def testLanguageTool(self):
88        try:
89            lt=getToolByName(self.portal, 'portal_languages')
90        except:
91            self.fail('No LanguageTool installed')
92        #self.failIf(lt.use_request_negotiation==1 , "Language tool thinks that browser settings may set the language")
93        self.failIf(lt.use_request_negotiation==0 , "Browser language request negotiation isn't used!")
94
95    def testMembersFolder(self):
96        self.addUser('test1','passwd1')
97        MEMBER_FOLDER="Community".lower()
98        MF=self.portal.portal_membership.getMembersFolder()
99        self.failUnless(re.search(MEMBER_FOLDER, MF.absolute_url_path()), "Members folder is not found in 'communities'")
100               
101    def testAddContentPortlet(self):
102        self.failIf('here/portlet_add_content/macros/portlet' not in self.portal.content.left_slots, 'Portlet "Add content" not visible')
103       
104    def testAddContentPortletLinks(self):
105        path=self.portal.content.absolute_url_path()
106        result=self.publish(path, basic=auth).getBody()
107        self.failUnless(re.search('/content/published', result),"The link to published in my content is missing.")
108        path=self.portal.content.published.absolute_url_path()
109        result=self.publish(path, basic=auth).getStatus()
110        self.failUnless(result==200 or result==302, "Loading topic page content/'my published' failed, status="+str(result))
111
112    def testRemotePortals(self):
113        remote_search=getToolByName(self.portal, 'lemill_search')
114        self.failIf(remote_search.getEnableRemoteSearch()==0, "Remote search is disabled")
115        self.failIf(remote_search.get_urls_of_remote_lemilles()==[], "Remote search urls are missing")
116
117def test_suite():
118    from unittest import TestSuite, makeSuite
119    suite = TestSuite()
120    suite.addTest(makeSuite(TestCustomization))
121    return suite
122
123if __name__ == '__main__':
124    framework()
Note: See TracBrowser for help on using the repository browser.