[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 | |
---|
| 32 | class MixinTestCase: |
---|
| 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() |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | class TestCase(MixinTestCase, ptc.PloneTestCase): |
---|
| 44 | """ For unit tests """ |
---|
| 45 | |
---|
| 46 | class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase): |
---|
| 47 | """ For functional tests """ |
---|
| 48 | |
---|
| 49 | # Initialize all needed zcml directives |
---|
| 50 | fiveconfigure.debug_mode = True |
---|
| 51 | from Products import Five, CMFCore, GenericSetup |
---|
| 52 | zcml.load_config('meta.zcml', Five) |
---|
| 53 | zcml.load_config('meta.zcml', CMFCore) |
---|
| 54 | zcml.load_config('meta.zcml', GenericSetup) |
---|
| 55 | zcml.load_config('permissions.zcml', Five) |
---|
| 56 | |
---|
| 57 | # Force quintagroup.plonegooglesitemaps zcml initialization |
---|
| 58 | zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) |
---|
| 59 | zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps) |
---|
| 60 | fiveconfigure.debug_mode = False |
---|
| 61 | |
---|
| 62 | # Install quintagroup.plonegooglesitemaps package and Plone site |
---|
| 63 | # with the default profile for the package |
---|
| 64 | PRODUCT = 'quintagroup.plonegooglesitemaps' |
---|
| 65 | ptc.installPackage(PRODUCT) |
---|
[2386] | 66 | ptc.setupPloneSite( products=(PRODUCT,)) |
---|