source: products/quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/base.py @ 2394

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

#131: Added TestNewsSitemapsXML

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1#
2# Tests for quintagroup.plonegooglesitemaps
3#
4
5import re, sys
6from urllib import urlencode
7from StringIO import StringIO
8import unittest
9
10from zope.testing import doctestunit
11from zope.component import testing
12from Testing import ZopeTestCase as ztc
13
14from Products.Five import zcml
15from Products.Five import fiveconfigure
16
17from Products.PloneTestCase import PloneTestCase as ptc
18from Products.PloneTestCase.layer import PloneSite
19from Products.PloneTestCase.setup import portal_owner
20from Products.PloneTestCase.setup import default_password
21
22from XMLParser import parse, hasURL
23
24import quintagroup.plonegooglesitemaps
25from quintagroup.plonegooglesitemaps.config import PROJECTNAME
26from quintagroup.plonegooglesitemaps.config import ping_googlesitemap
27
28quintagroup.plonegooglesitemaps.config.testing = 1
29quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True
30
31
32class 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
43class TestCase(MixinTestCase, ptc.PloneTestCase):
44    """ For unit tests """
45
46class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
47    """ For functional tests """
48
49# Initialize all needed zcml directives
50fiveconfigure.debug_mode = True
51from Products import Five, CMFCore, GenericSetup
52zcml.load_config('meta.zcml', Five)
53zcml.load_config('meta.zcml', CMFCore)
54zcml.load_config('meta.zcml', GenericSetup)
55zcml.load_config('permissions.zcml', Five)
56
57# Force quintagroup.plonegooglesitemaps zcml initialization
58zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
59zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
60fiveconfigure.debug_mode = False
61
62# Install quintagroup.plonegooglesitemaps package and Plone site
63# with the default profile for the package
64PRODUCT = 'quintagroup.plonegooglesitemaps'
65ptc.installPackage(PRODUCT)
66ptc.setupPloneSite( products=(PRODUCT,))
Note: See TracBrowser for help on using the repository browser.