source: products/quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testInstallation.py @ 2538

Last change on this file since 2538 was 2538, checked in by mylan, 9 years ago

Merged revisions 3566-3575 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/test_refactoring

........

r3566 | mylan | 2010-06-14 12:24:52 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Split single testqPloneGoogleSitemaps module into several specific one

........

r3567 | mylan | 2010-06-14 16:14:34 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Improve code coverage - remove useless BBB code from interfaces.

........

r3568 | mylan | 2010-06-14 20:24:25 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Improve code coverage - added test for MobileSitemap?, MobileSitemapView?.

........

r3569 | mylan | 2010-06-14 22:39:39 +0300 (Mon, 14 Jun 2010) | 1 line


#206: reorganize sitemap tests

........

r3570 | mylan | 2010-06-14 22:40:12 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Added configlet tests

........

r3571 | mylan | 2010-06-14 23:05:19 +0300 (Mon, 14 Jun 2010) | 1 line


#206: remove BBB code for plone<3.0

........

r3572 | mylan | 2010-06-14 23:12:00 +0300 (Mon, 14 Jun 2010) | 1 line


#206: added workflow vocabularies tests for SitemapTypes?

........

r3573 | mylan | 2010-06-15 21:36:40 +0300 (Tue, 15 Jun 2010) | 1 line


#206: some cleanup, simplify tests

........

r3574 | mylan | 2010-06-16 16:35:31 +0300 (Wed, 16 Jun 2010) | 1 line


#206: move mobile sitemap code preparation into base module

........

r3575 | mylan | 2010-06-16 16:37:14 +0300 (Wed, 16 Jun 2010) | 1 line


#206: Added security tests

........

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1from base import *
2from zope.component import getSiteManager
3from archetypes.schemaextender.interfaces import ISchemaExtender
4
5
6class TestGoogleSitemapsInstallation(TestCase):
7
8    def testType(self):
9        pt = self.portal.portal_types
10        self.assert_('Sitemap' in pt.objectIds(), 
11            'No "Sitemap" type after installation')
12        #Test views
13        views = pt.getTypeInfo('Sitemap').view_methods
14        self.assert_('sitemap.xml' in views, 
15            'No "sitemap.xml" view for Sitemap type')
16        self.assert_('mobile-sitemap.xml' in views, 
17            'No "mobile-sitemap.xml" view for Sitemap type')
18        self.assert_('news-sitemap.xml' in views, 
19            'No "news-sitemap.xml" view for Sitemap type')
20
21    def testGSMProperties(self):
22        pp = self.portal.portal_properties
23
24        # Test types_not_searched
25        self.assert_("Sitemap" in pp['site_properties'].getProperty('types_not_searched'), 
26            'No "Sitemap" added to types not searched on installation')
27        # Test metaTypesNotToList
28        self.assert_("Sitemap" in pp['navtree_properties'].getProperty('metaTypesNotToList'), 
29            'No "Sitemap" added to types not to list on installation')
30
31        # Test 'googlesitemap_properties'
32        self.assert_('googlesitemap_properties' in pp.objectIds(), 
33            'No "googlesitemap_properties" after installation')
34        qsmprops = pp['googlesitemap_properties']
35        self.assert_(qsmprops.hasProperty('verification_filenames'),
36            'No "verification_filenames" property added on installation')
37
38    def testSkins(self):
39        ps = self.portal.portal_skins
40        self.assert_('plonegooglesitemaps' in ps.objectIds(), 
41            'No "plonegooglesitemaps" skin layer in portal_skins')
42        self.assert_('plonegooglesitemaps' in ps.getSkinPath(ps.getDefaultSkin()),
43            'No "plonegooglesitemaps" skin layer in default skin')
44
45    def testConfiglet(self):
46        cp = self.portal.portal_controlpanel
47        self.assert_([1 for ai in cp.listActionInfos() if ai['id']=='GoogleSitemaps'], 
48            'No "GoogleSitemaps" configlet added to plone control panel')
49
50    def testNewsSchemaExtenderRegistered(self):
51        lsm = getSiteManager(self.portal)
52        news = self.portal.invokeFactory("News Item", id="test_news")
53        news = getattr(self.portal, "test_news")
54        self.assertNotEqual(lsm.queryAdapter(news, interface=ISchemaExtender), None)
55
56
57class TestGoogleSitemapsUninstallation(TestCase):
58
59    def afterSetUp(self):
60        super(TestGoogleSitemapsUninstallation, self).afterSetUp()
61        self.portal.portal_quickinstaller.uninstallProducts(
62            products=['quintagroup.plonegooglesitemaps',])
63        self._refreshSkinData()
64
65    def testNewsSchemaExtenderUnregistered(self):
66        lsm = getSiteManager(self.portal)
67        news = self.portal.invokeFactory("News Item", id="test_news")
68        news = getattr(self.portal, "test_news")
69        self.assertEqual(lsm.queryAdapter(news, interface=ISchemaExtender), None)
70
71
72def test_suite():
73    from unittest import TestSuite, makeSuite
74    suite = TestSuite()
75    suite.addTest(makeSuite(TestGoogleSitemapsInstallation))
76    suite.addTest(makeSuite(TestGoogleSitemapsUninstallation))
77    return suite
78
79if __name__ == '__main__':
80    unittest.main(defaultTest='test_suite')
81#    framework()
Note: See TracBrowser for help on using the repository browser.