[2382] | 1 | # |
---|
| 2 | # Tests for quintagroup.plonegooglesitemaps |
---|
| 3 | # |
---|
| 4 | |
---|
| 5 | import re, sys |
---|
| 6 | from urllib import urlencode |
---|
| 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 |
---|
| 13 | |
---|
| 14 | from Products.Five import zcml |
---|
| 15 | from Products.Five import fiveconfigure |
---|
| 16 | |
---|
| 17 | from Products.PloneTestCase import PloneTestCase as ptc |
---|
| 18 | from Products.PloneTestCase.layer import PloneSite |
---|
[2394] | 19 | from Products.PloneTestCase.setup import portal_owner |
---|
| 20 | from Products.PloneTestCase.setup import default_password |
---|
[2382] | 21 | |
---|
| 22 | from XMLParser import parse, hasURL |
---|
| 23 | |
---|
| 24 | import quintagroup.plonegooglesitemaps |
---|
[2386] | 25 | from quintagroup.plonegooglesitemaps.config import PROJECTNAME |
---|
[2382] | 26 | from quintagroup.plonegooglesitemaps.config import ping_googlesitemap |
---|
| 27 | |
---|
| 28 | quintagroup.plonegooglesitemaps.config.testing = 1 |
---|
| 29 | quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True |
---|
| 30 | |
---|
| 31 | |
---|
[2534] | 32 | class MixinTestCase(object): |
---|
[2382] | 33 | """ Define layer and common afterSetup method with package installation. |
---|
| 34 | Package installation on plone site setup impossible because of |
---|
| 35 | five's registerPackage directive not recognized on module initializing. |
---|
| 36 | """ |
---|
| 37 | layer = PloneSite |
---|
| 38 | |
---|
| 39 | def afterSetUp(self): |
---|
| 40 | self.loginAsPortalOwner() |
---|
[2534] | 41 | self.workflow = self.portal.portal_workflow |
---|
[2382] | 42 | |
---|
| 43 | |
---|
| 44 | class TestCase(MixinTestCase, ptc.PloneTestCase): |
---|
| 45 | """ For unit tests """ |
---|
| 46 | |
---|
[2534] | 47 | |
---|
[2382] | 48 | class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase): |
---|
| 49 | """ For functional tests """ |
---|
| 50 | |
---|
[2534] | 51 | def afterSetUp(self): |
---|
| 52 | super(FunctionalTestCase, self).afterSetUp() |
---|
| 53 | self.auth = "%s:%s" % (portal_owner, default_password) |
---|
| 54 | |
---|
[2382] | 55 | # Initialize all needed zcml directives |
---|
| 56 | fiveconfigure.debug_mode = True |
---|
| 57 | from Products import Five, CMFCore, GenericSetup |
---|
| 58 | zcml.load_config('meta.zcml', Five) |
---|
| 59 | zcml.load_config('meta.zcml', CMFCore) |
---|
| 60 | zcml.load_config('meta.zcml', GenericSetup) |
---|
| 61 | zcml.load_config('permissions.zcml', Five) |
---|
| 62 | |
---|
| 63 | # Force quintagroup.plonegooglesitemaps zcml initialization |
---|
| 64 | zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) |
---|
| 65 | zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps) |
---|
| 66 | fiveconfigure.debug_mode = False |
---|
| 67 | |
---|
| 68 | # Install quintagroup.plonegooglesitemaps package and Plone site |
---|
| 69 | # with the default profile for the package |
---|
| 70 | PRODUCT = 'quintagroup.plonegooglesitemaps' |
---|
| 71 | ptc.installPackage(PRODUCT) |
---|
[2386] | 72 | ptc.setupPloneSite( products=(PRODUCT,)) |
---|