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

Last change on this file since 3002 was 3002, checked in by mylan, 11 years ago

Merged revisions 3948,3950-3951,3954-3964,3978-3981,3984-3992,4016-4018,4028-4037,4039 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/blacklist

........

r3948 | mylan | 2010-10-21 16:34:22 +0300 (Thu, 21 Oct 2010) | 1 line


#228: Added IBlackoutFilterUtility interface with skeleton of id and path utilities with appropriate tests.

........

r3950 | mylan | 2010-10-22 11:58:53 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added tests for default id and path filters

........

r3951 | mylan | 2010-10-22 11:59:25 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added default id and path blackout filters

........

r3954 | mylan | 2010-10-22 14:38:20 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added TestFormDataProcessing? tests

........

r3955 | mylan | 2010-10-22 14:38:57 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added getBOFiltered method to sitemap common view

........

r3956 | mylan | 2010-10-22 15:17:40 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Simplify blacklists filter utility tests

........

r3957 | mylan | 2010-10-22 15:23:24 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Minor name updates in blackout list tests

........

r3958 | mylan | 2010-10-22 15:54:10 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added tests for relative path in path-filter

........

r3959 | mylan | 2010-10-22 15:54:50 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added relative path processing in default path-filter

........

r3960 | mylan | 2010-10-22 15:57:18 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Fixed name of the relative path filtering test

........

r3961 | mylan | 2010-10-25 13:51:32 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fix relative path filter tests and utility

........

r3962 | mylan | 2010-10-25 17:38:55 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fixed default Path filter

........

r3963 | mylan | 2010-10-25 17:49:27 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Added request to extended list of args for a filter utility.

........

r3964 | mylan | 2010-10-25 17:50:57 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fixed rewrited blackout filter utility and functionality.

........

r3978 | mylan | 2010-10-28 19:26:11 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Remake filter utility to multiadapter, fix tests

........

r3979 | mylan | 2010-10-28 19:57:24 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Fix filter naming overhead, fix tests

........

r3980 | mylan | 2010-10-28 21:10:51 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Fix overhead in parsing of filter arguments. Added test (breakage yet)

........

r3981 | mylan | 2010-10-29 12:57:34 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Add blackout_list value clean-up on editing sitemap

........

r3984 | mylan | 2010-10-29 13:53:54 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Update description of blackout list, remove preparations to filtering

........

r3985 | mylan | 2010-10-29 16:14:29 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Added doc tests bases

........

r3986 | mylan | 2010-10-29 16:53:41 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Added basic doctests of filtering

........

r3987 | mylan | 2010-10-29 16:57:40 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Minor fixes of filtering doctests.

........

r3988 | mylan | 2010-11-01 13:31:04 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Added doctests of id, path, default filters

........

r3989 | mylan | 2010-11-01 15:20:03 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Fixed default behavior filter doctests

........

r3990 | mylan | 2010-11-01 15:20:51 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Added example of new filter creation in doctests

........

r3991 | mylan | 2010-11-01 15:35:10 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Clean-up, simplify filters doctests

........

r3992 | mylan | 2010-11-01 15:39:55 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Force to show all doctests failures.

........

r4016 | mylan | 2010-11-05 14:19:46 +0200 (Fri, 05 Nov 2010) | 1 line


#228: Fix incorrect black_list field editing in tests

........

r4017 | mylan | 2010-11-05 14:21:35 +0200 (Fri, 05 Nov 2010) | 1 line


#228: minor docstring update for getBOFiltered method

........

r4018 | mylan | 2010-11-05 14:23:56 +0200 (Fri, 05 Nov 2010) | 1 line


#228: Remake filterOut method of into generator for default filters

........

r4028 | mylan | 2010-11-08 13:58:10 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Added Plone v3.0 support

........

r4029 | mylan | 2010-11-08 16:35:22 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed tests issues

........

r4030 | mylan | 2010-11-08 16:49:28 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed ran of tearing down testing layers

........

r4031 | mylan | 2010-11-08 17:04:01 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed differencies in forms for plone<=3.1 and plone>3.1

........

r4032 | mylan | 2010-11-10 13:48:47 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Switch to use collective.testcaselayer

........

r4033 | mylan | 2010-11-10 13:49:09 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Fix doctest testcase

........

r4034 | mylan | 2010-11-10 14:34:17 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Fixed list of required packages for testing

........

r4035 | mylan | 2010-11-11 12:29:06 +0200 (Thu, 11 Nov 2010) | 1 line


#228: remake filters to generators

........

r4036 | mylan | 2010-11-11 15:16:53 +0200 (Thu, 11 Nov 2010) | 1 line


#228: reviewed explanation, correct grammar for filters doctest

........

r4037 | mylan | 2010-11-11 15:19:24 +0200 (Thu, 11 Nov 2010) | 1 line


#228: updated histroy, bumped version to 1.6.0

........

r4039 | mylan | 2010-11-11 19:03:01 +0200 (Thu, 11 Nov 2010) | 1 line


#228:Fixed typo in doctests

........

  • Property svn:eol-style set to native
File size: 4.3 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
34from collective.testcaselayer.ptc import BasePTCLayer, ptc_layer
35
36quintagroup.plonegooglesitemaps.config.testing = 1
37quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True
38
39PRODUCT = 'quintagroup.plonegooglesitemaps'
40
41
42class NotInstalled(BasePTCLayer):
43    """Initialize the package, without installation into portal
44    """
45    def afterSetUp(self):
46        fiveconfigure.debug_mode = True
47        import quintagroup.plonegooglesitemaps
48        zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
49        zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
50        fiveconfigure.debug_mode = False
51
52        if not ptc.PLONE31:
53            ztc.installProduct("plone.browserlayer")
54
55        ztc.installPackage(PRODUCT)
56
57
58class Installed(BasePTCLayer):
59    """ Install product into the portal
60    """
61    def afterSetUp(self):
62        if not ptc.PLONE31:
63            self.addProduct("plone.browserlayer")
64        self.addProduct(PRODUCT)
65
66class UnInstalled(BasePTCLayer):
67    """ UnInstall product from the portal
68    """
69    def afterSetUp(self):
70        qi = getattr(self.portal, 'portal_quickinstaller', None)
71        qi.uninstallProducts(products=[PRODUCT,])
72
73
74NotInstalledLayer = NotInstalled([ptc_layer,])
75InstalledLayer = Installed([NotInstalledLayer,])
76UnInstalledLayer = UnInstalled([InstalledLayer,])
77
78
79class IMobileMarker(Interface):
80    """Test Marker interface for mobile objects"""
81
82
83class MixinTestCase(object):
84    """ Define layer and common afterSetup method with package installation.
85        Package installation on plone site setup impossible because of
86        five's registerPackage directive not recognized on module initializing.
87    """
88    def afterSetUp(self):
89        self.loginAsPortalOwner()
90        self.workflow = self.portal.portal_workflow
91        self.orig_mobile_ifaces = None
92        alsoProvides(self.portal.REQUEST, IGoogleSitemapsLayer)
93
94    def patchMobile(self):
95        # patch mobile sitemap view
96        self.orig_mobile_ifaces = mobilesitemapview.MOBILE_INTERFACES
97        mobilesitemapview.MOBILE_INTERFACES = [IMobileMarker.__identifier__,]
98
99    def beforeTearDown(self):
100        if getattr(self, 'orig_mobile_ifaces', None) is not None:
101            mobilesitemapview.MOBILE_INTERFACES = self.orig_mobile_ifaces
102
103
104class TestCaseNotInstalled(ptc.PloneTestCase):
105    layer = NotInstalledLayer
106
107class TestCase(ptc.PloneTestCase, MixinTestCase):
108    layer = InstalledLayer
109
110    def afterSetUp(self):
111        ptc.PloneTestCase.afterSetUp(self)
112        MixinTestCase.afterSetUp(self)
113
114    def beforeTearDown(self):
115        ptc.PloneTestCase.beforeTearDown(self)
116        MixinTestCase.beforeTearDown(self)
117
118
119class TestCaseUnInstalled(ptc.PloneTestCase):
120    layer = UnInstalledLayer
121
122
123class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase):
124    layer = NotInstalledLayer
125
126class FunctionalTestCase(ptc.FunctionalTestCase, MixinTestCase):
127    layer = InstalledLayer
128
129    def afterSetUp(self):
130        ptc.FunctionalTestCase.afterSetUp(self)
131        MixinTestCase.afterSetUp(self)
132        self.auth = "%s:%s" % (portal_owner, default_password)
133
134    def beforeTearDown(self):
135        ptc.FunctionalTestCase.beforeTearDown(self)
136        MixinTestCase.beforeTearDown(self)
137
138class FunctionalTestCaseUnInstalled(ptc.FunctionalTestCase):
139    layer = UnInstalledLayer
Note: See TracBrowser for help on using the repository browser.