source: products/quintagroup.plonegooglesitemaps/tags/1.4.4/quintagroup/plonegooglesitemaps/tests/base.py

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

Merged revisions 3566-3575 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/test_refactoring

........

r3566 | mylan | 2010-06-14 12:24:52 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Split single testqPloneGoogleSitemaps module into several specific one

........

r3567 | mylan | 2010-06-14 16:14:34 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Improve code coverage - remove useless BBB code from interfaces.

........

r3568 | mylan | 2010-06-14 20:24:25 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Improve code coverage - added test for MobileSitemap?, MobileSitemapView?.

........

r3569 | mylan | 2010-06-14 22:39:39 +0300 (Mon, 14 Jun 2010) | 1 line


#206: reorganize sitemap tests

........

r3570 | mylan | 2010-06-14 22:40:12 +0300 (Mon, 14 Jun 2010) | 1 line


#206: Added configlet tests

........

r3571 | mylan | 2010-06-14 23:05:19 +0300 (Mon, 14 Jun 2010) | 1 line


#206: remove BBB code for plone<3.0

........

r3572 | mylan | 2010-06-14 23:12:00 +0300 (Mon, 14 Jun 2010) | 1 line


#206: added workflow vocabularies tests for SitemapTypes?

........

r3573 | mylan | 2010-06-15 21:36:40 +0300 (Tue, 15 Jun 2010) | 1 line


#206: some cleanup, simplify tests

........

r3574 | mylan | 2010-06-16 16:35:31 +0300 (Wed, 16 Jun 2010) | 1 line


#206: move mobile sitemap code preparation into base module

........

r3575 | mylan | 2010-06-16 16:37:14 +0300 (Wed, 16 Jun 2010) | 1 line


#206: Added security tests

........

  • Property svn:eol-style set to native
File size: 2.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.interface import Interface
12from zope.component import testing
13from Testing import ZopeTestCase as ztc
14
15from Products.Five import zcml
16from Products.Five import fiveconfigure
17
18from Products.PloneTestCase import PloneTestCase as ptc
19from Products.PloneTestCase.layer import PloneSite
20from Products.PloneTestCase.setup import portal_owner
21from Products.PloneTestCase.setup import default_password
22
23from XMLParser import parse, hasURL
24
25import quintagroup.plonegooglesitemaps
26from quintagroup.plonegooglesitemaps.config import PROJECTNAME
27from quintagroup.plonegooglesitemaps.config import ping_googlesitemap
28from quintagroup.plonegooglesitemaps.browser import mobilesitemapview
29
30quintagroup.plonegooglesitemaps.config.testing = 1
31quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True
32
33
34class IMobileMarker(Interface):
35    """Test Marker interface for mobile objects"""
36
37
38class MixinTestCase(object):
39    """ Define layer and common afterSetup method with package installation.
40        Package installation on plone site setup impossible because of
41        five's registerPackage directive not recognized on module initializing.
42    """
43    layer = PloneSite
44
45    def afterSetUp(self):
46        self.loginAsPortalOwner()
47        self.workflow = self.portal.portal_workflow
48        self.orig_mobile_ifaces = None
49
50    def patchMobile(self):
51        # patch mobile sitemap view
52        self.orig_mobile_ifaces = mobilesitemapview.MOBILE_INTERFACES
53        mobilesitemapview.MOBILE_INTERFACES = [IMobileMarker.__identifier__,]
54
55    def beforeTearDown(self):
56        if self.orig_mobile_ifaces is not None:
57            mobilesitemapview.MOBILE_INTERFACES = self.orig_mobile_ifaces
58
59
60class TestCase(MixinTestCase, ptc.PloneTestCase):
61    """ For unit tests """
62
63
64class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
65    """ For functional tests """
66
67    def afterSetUp(self):
68        super(FunctionalTestCase, self).afterSetUp()
69        self.auth = "%s:%s" % (portal_owner, default_password)
70
71# Initialize all needed zcml directives
72fiveconfigure.debug_mode = True
73from Products import Five, CMFCore, GenericSetup
74zcml.load_config('meta.zcml', Five)
75zcml.load_config('meta.zcml', CMFCore)
76zcml.load_config('meta.zcml', GenericSetup)
77zcml.load_config('permissions.zcml', Five)
78
79# Force quintagroup.plonegooglesitemaps zcml initialization
80zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
81zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
82fiveconfigure.debug_mode = False
83
84# Install quintagroup.plonegooglesitemaps package and Plone site
85# with the default profile for the package
86PRODUCT = 'quintagroup.plonegooglesitemaps'
87ptc.installPackage(PRODUCT)
88ptc.setupPloneSite( products=(PRODUCT,))
Note: See TracBrowser for help on using the repository browser.