source: products/quintagroup.plonegooglesitemaps/tags/1.5.6/quintagroup/plonegooglesitemaps/tests/base.py @ 3665

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

Added support of migration from qPloneGoogleSitemaps product
to quintagroup.plonegooglesitemaps with tests.
Also all views now registered on own browserlayer.

Merged revisions 3865,3867-3872,3874-3878 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/migratioin_product

........

r3865 | mylan | 2010-09-15 20:54:50 +0300 (Wed, 15 Sep 2010) | 1 line


#230: Added module aliases - prevent breakage sitemap, created with qPloneGoogleSitemaps

........

r3867 | mylan | 2010-09-17 11:41:35 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added browserlayer and registered all sitemaps views and configlet view to it

........

r3868 | mylan | 2010-09-17 13:12:09 +0300 (Fri, 17 Sep 2010) | 1 line


#230: remove module aliases

........

r3869 | mylan | 2010-09-17 13:13:14 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added migration from qPloneGoogleSitemaps to quintagroup.plonegooglesitemaps

........

r3870 | mylan | 2010-09-17 14:02:47 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added upgrade/migration step by step reference.

........

r3871 | mylan | 2010-09-17 14:41:04 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Fix tests after registering all views to the browser layer

........

r3872 | mylan | 2010-09-17 14:55:43 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added uninstallation browserlayer and updated install/uninstall tests

........

r3874 | mylan | 2010-09-20 13:12:26 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Added test for browser layer uninstallation

........

r3875 | mylan | 2010-09-20 15:37:00 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Fix cleanup during migration from the qPloneGoogleSitemaps

........

r3876 | mylan | 2010-09-20 15:38:18 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Fix typos in GS profile and import step

........

r3877 | mylan | 2010-09-20 18:23:20 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Added tests of migration from qPloneGoogleSitemap to quintagroup.plonegooglesitemap.

........

r3878 | mylan | 2010-09-22 14:17:07 +0300 (Wed, 22 Sep 2010) | 1 line


#230: some upgrade tests reorganization

........

  • Property svn:eol-style set to native
File size: 3.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.interface import Interface
12from zope.component import testing
13from zope.interface import alsoProvides
14from Testing import ZopeTestCase as ztc
15
16from Products.Five import zcml
17from Products.Five import fiveconfigure
18
19from Products.PloneTestCase import PloneTestCase as ptc
20from Products.PloneTestCase.layer import onsetup
21from Products.PloneTestCase.layer import PloneSite
22from Products.PloneTestCase.setup import portal_owner
23from Products.PloneTestCase.setup import default_password
24
25from XMLParser import parse, hasURL
26
27import quintagroup.plonegooglesitemaps
28from quintagroup.plonegooglesitemaps.config import PROJECTNAME
29from quintagroup.plonegooglesitemaps.config import ping_googlesitemap
30from quintagroup.plonegooglesitemaps.config import SUPPORT_BLAYER
31from quintagroup.plonegooglesitemaps.browser import mobilesitemapview
32from quintagroup.plonegooglesitemaps.interfaces import IGoogleSitemapsLayer
33
34quintagroup.plonegooglesitemaps.config.testing = 1
35quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True
36
37PRODUCT = 'quintagroup.plonegooglesitemaps'
38
39@onsetup
40def setup_product():
41    """Set up the package and its dependencies.
42
43    The @onsetup decorator causes the execution of this body to be
44    deferred until the setup of the Plone site testing layer. We could
45    have created our own layer, but this is the easiest way for Plone
46    integration tests.
47    """
48    fiveconfigure.debug_mode = True
49    import quintagroup.plonegooglesitemaps
50    zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
51    zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
52    fiveconfigure.debug_mode = False
53
54    ztc.installPackage(PRODUCT)
55
56setup_product()
57ptc.setupPloneSite( products=(PRODUCT,))
58
59
60class IMobileMarker(Interface):
61    """Test Marker interface for mobile objects"""
62
63
64class MixinTestCase(object):
65    """ Define layer and common afterSetup method with package installation.
66        Package installation on plone site setup impossible because of
67        five's registerPackage directive not recognized on module initializing.
68    """
69    layer = PloneSite
70
71    def afterSetUp(self):
72        self.loginAsPortalOwner()
73        self.workflow = self.portal.portal_workflow
74        self.orig_mobile_ifaces = None
75        alsoProvides(self.portal.REQUEST, IGoogleSitemapsLayer)
76
77    def patchMobile(self):
78        # patch mobile sitemap view
79        self.orig_mobile_ifaces = mobilesitemapview.MOBILE_INTERFACES
80        mobilesitemapview.MOBILE_INTERFACES = [IMobileMarker.__identifier__,]
81
82    def beforeTearDown(self):
83        if self.orig_mobile_ifaces is not None:
84            mobilesitemapview.MOBILE_INTERFACES = self.orig_mobile_ifaces
85
86
87class TestCase(MixinTestCase, ptc.PloneTestCase):
88    """ For unit tests """
89
90
91class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
92    """ For functional tests """
93
94    def afterSetUp(self):
95        super(FunctionalTestCase, self).afterSetUp()
96        self.auth = "%s:%s" % (portal_owner, default_password)
97
Note: See TracBrowser for help on using the repository browser.