Changeset 1619 in products
- Timestamp:
- Feb 2, 2010 12:39:23 PM (15 years ago)
- Location:
- quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps
- Files:
-
- 3 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testqPloneGoogleSitemaps.py
r1593 r1619 1 1 # 2 # Tests for q PloneGoogleSitemaps2 # Tests for quintagroup.plonegooglesitemaps 3 3 # 4 4 5 import re, sys 5 6 from urllib import urlencode 6 7 from StringIO import StringIO 8 import unittest 9 10 from zope.testing import doctestunit 11 from zope.component import testing 12 from Testing import ZopeTestCase as ztc 7 13 8 14 from Products.Five import zcml 9 15 from Products.Five import fiveconfigure 10 from Products.PloneTestCase import PloneTestCase 11 16 17 from Products.PloneTestCase import PloneTestCase as ptc 18 from Products.PloneTestCase.layer import PloneSite 12 19 from Products.CMFPlone.utils import _createObjectByType 20 21 from XMLParser import parse, hasURL 13 22 14 23 import quintagroup.plonegooglesitemaps 15 24 from quintagroup.plonegooglesitemaps.config import ping_googlesitemap 16 25 17 from XMLParser import parse, hasURL18 26 quintagroup.plonegooglesitemaps.config.testing = 1 19 27 20 PRODUCT = 'qPloneGoogleSitemaps' 21 PRODUCTS = (PRODUCT,) 22 23 # Import configure.zcml for qPloneGoogleSitemaps 28 class MixinTestCase: 29 """ Define layer and common afterSetup method with package installation. 30 Package installation on plone site setup impossible because of 31 five's registerPackage directive not recognized on module initializing. 32 """ 33 layer = PloneSite 34 35 def afterSetUp(self): 36 self.loginAsPortalOwner() 37 38 39 class TestCase(MixinTestCase, ptc.PloneTestCase): 40 """ For unit tests """ 41 42 class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase): 43 """ For functional tests """ 44 45 # Initialize all needed zcml directives 24 46 fiveconfigure.debug_mode = True 47 from Products import Five, CMFCore, GenericSetup 48 zcml.load_config('meta.zcml', Five) 49 zcml.load_config('meta.zcml', CMFCore) 50 zcml.load_config('meta.zcml', GenericSetup) 51 zcml.load_config('permissions.zcml', Five) 52 53 # Force quintagroup.plonegooglesitemaps zcml initialization 25 54 zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) 26 55 fiveconfigure.debug_mode = False 27 56 28 PloneTestCase.installProduct(PRODUCT) 29 PloneTestCase.setupPloneSite(extension_profiles=("Products.%s:default" % PRODUCT,)) 30 31 class TestqPloneGoogleSitemapsInstallation(PloneTestCase.PloneTestCase): 32 33 def afterSetUp(self): 34 self.loginAsPortalOwner() 57 # Install quintagroup.plonegooglesitemaps package and Plone site 58 # with the default profile for the package 59 PRODUCT = 'quintagroup.plonegooglesitemaps' 60 ptc.installPackage(PRODUCT) 61 ptc.setupPloneSite( extension_profiles=("%s:default" % PRODUCT,)) 62 63 64 class TestGoogleSitemapsInstallation(TestCase): 35 65 36 66 def testType(self): … … 66 96 def testSkins(self): 67 97 ps = self.portal.portal_skins 68 self.assert_(' qPloneGoogleSitemaps' in ps.objectIds(),69 'No " qPloneGoogleSitemaps" skin layer in portal_skins')70 self.assert_(' qPloneGoogleSitemaps' in ps.getSkinPath(ps.getDefaultSkin()),71 'No " qPloneGoogleSitemaps" skin layer in default skin')98 self.assert_('plonegooglesitemaps' in ps.objectIds(), 99 'No "plonegooglesitemaps" skin layer in portal_skins') 100 self.assert_('plonegooglesitemaps' in ps.getSkinPath(ps.getDefaultSkin()), 101 'No "plonegooglesitemaps" skin layer in default skin') 72 102 73 103 def testConfiglet(self): 74 104 cp = self.portal.portal_controlpanel 75 self.assert_([1 for ai in cp.listActionInfos() if ai['id']==' qPloneGoogleSitemaps'],76 'No " qPloneGoogleSitemaps" configlet added to plone control panel')105 self.assert_([1 for ai in cp.listActionInfos() if ai['id']=='GoogleSitemaps'], 106 'No "GoogleSitemaps" configlet added to plone control panel') 77 107 78 108 def testCatalog(self): … … 82 112 83 113 84 class TestSitemapType( PloneTestCase.FunctionalTestCase):114 class TestSitemapType(FunctionalTestCase): 85 115 86 116 def afterSetUp(self): 87 s elf.loginAsPortalOwner()117 super(TestSitemapType, self).afterSetUp() 88 118 self.auth = 'admin:admin' 89 119 self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps') … … 137 167 138 168 139 class Test qPloneGoogleSitemaps(PloneTestCase.FunctionalTestCase):169 class TestGoogleSitemaps(FunctionalTestCase): 140 170 141 171 def afterSetUp(self): 142 s elf.loginAsPortalOwner()172 super(TestGoogleSitemaps, self).afterSetUp() 143 173 144 174 self.workflow = self.portal.portal_workflow … … 234 264 235 265 236 class TestSettings( PloneTestCase.FunctionalTestCase):266 class TestSettings(FunctionalTestCase): 237 267 238 268 def afterSetUp(self): 239 s elf.loginAsPortalOwner()269 super(TestSettings, self).afterSetUp() 240 270 241 271 self.workflow = self.portal.portal_workflow … … 315 345 316 346 317 class TestPinging( PloneTestCase.FunctionalTestCase):347 class TestPinging(FunctionalTestCase): 318 348 319 349 def afterSetUp(self): 320 s elf.loginAsPortalOwner()350 super(TestPinging, self).afterSetUp() 321 351 322 352 self.workflow = self.portal.portal_workflow … … 386 416 from unittest import TestSuite, makeSuite 387 417 suite = TestSuite() 388 suite.addTest(makeSuite(Test qPloneGoogleSitemapsInstallation))418 suite.addTest(makeSuite(TestGoogleSitemapsInstallation)) 389 419 suite.addTest(makeSuite(TestSitemapType)) 390 suite.addTest(makeSuite(Test qPloneGoogleSitemaps))420 suite.addTest(makeSuite(TestGoogleSitemaps)) 391 421 suite.addTest(makeSuite(TestSettings)) 392 422 suite.addTest(makeSuite(TestPinging)) 393 394 423 return suite 395 424 396 425 if __name__ == '__main__': 397 framework() 426 unittest.main(defaultTest='test_suite') 427 # framework()
Note: See TracChangeset
for help on using the changeset viewer.