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

Last change on this file since 2382 was 2382, checked in by mylan, 14 years ago

#205: Extract common for all tests part into separate base.py module

  • Property svn:eol-style set to native
File size: 1.9 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
19
20from XMLParser import parse, hasURL
21
22import quintagroup.plonegooglesitemaps
23from quintagroup.plonegooglesitemaps.config import ping_googlesitemap
24
25quintagroup.plonegooglesitemaps.config.testing = 1
26quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True
27
28
29class MixinTestCase:
30    """ Define layer and common afterSetup method with package installation.
31        Package installation on plone site setup impossible because of
32        five's registerPackage directive not recognized on module initializing.
33    """
34    layer = PloneSite
35
36    def afterSetUp(self):
37        self.loginAsPortalOwner()
38
39
40class TestCase(MixinTestCase, ptc.PloneTestCase):
41    """ For unit tests """
42
43class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
44    """ For functional tests """
45
46# Initialize all needed zcml directives
47fiveconfigure.debug_mode = True
48from Products import Five, CMFCore, GenericSetup
49zcml.load_config('meta.zcml', Five)
50zcml.load_config('meta.zcml', CMFCore)
51zcml.load_config('meta.zcml', GenericSetup)
52zcml.load_config('permissions.zcml', Five)
53
54# Force quintagroup.plonegooglesitemaps zcml initialization
55zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
56zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
57fiveconfigure.debug_mode = False
58
59# Install quintagroup.plonegooglesitemaps package and Plone site
60# with the default profile for the package
61PRODUCT = 'quintagroup.plonegooglesitemaps'
62ptc.installPackage(PRODUCT)
63ptc.setupPloneSite( extension_profiles=("%s:default" % PRODUCT,))
Note: See TracBrowser for help on using the repository browser.