Changeset 2382 in products


Ignore:
Timestamp:
May 25, 2010 5:20:14 PM (14 years ago)
Author:
mylan
Message:

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

Location:
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testqPloneGoogleSitemaps.py

    r2170 r2382  
    33# 
    44 
    5 import re, sys 
    6 from urllib import urlencode 
    7 from StringIO import StringIO 
    8 import unittest 
    9  
    10 from zope.testing import doctestunit 
    11 from zope.component import testing 
    12 from Testing import ZopeTestCase as ztc 
    13  
    14 from Products.Five import zcml 
    15 from Products.Five import fiveconfigure 
    16  
    17 from Products.PloneTestCase import PloneTestCase as ptc 
    18 from Products.PloneTestCase.layer import PloneSite 
     5from base import * 
    196from Products.CMFPlone.utils import _createObjectByType 
    20  
    21 from XMLParser import parse, hasURL 
    22  
    23 import quintagroup.plonegooglesitemaps 
    24 from quintagroup.plonegooglesitemaps.config import ping_googlesitemap 
    25  
    26 quintagroup.plonegooglesitemaps.config.testing = 1 
    27 quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True 
    28  
    29  
    30 class MixinTestCase: 
    31     """ Define layer and common afterSetup method with package installation. 
    32         Package installation on plone site setup impossible because of 
    33         five's registerPackage directive not recognized on module initializing. 
    34     """ 
    35     layer = PloneSite 
    36  
    37     def afterSetUp(self): 
    38         self.loginAsPortalOwner() 
    39  
    40  
    41 class TestCase(MixinTestCase, ptc.PloneTestCase): 
    42     """ For unit tests """ 
    43  
    44 class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase): 
    45     """ For functional tests """ 
    46  
    47 # Initialize all needed zcml directives 
    48 fiveconfigure.debug_mode = True 
    49 from Products import Five, CMFCore, GenericSetup 
    50 zcml.load_config('meta.zcml', Five) 
    51 zcml.load_config('meta.zcml', CMFCore) 
    52 zcml.load_config('meta.zcml', GenericSetup) 
    53 zcml.load_config('permissions.zcml', Five) 
    54  
    55 # Force quintagroup.plonegooglesitemaps zcml initialization 
    56 zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) 
    57 zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps) 
    58 fiveconfigure.debug_mode = False 
    59  
    60 # Install quintagroup.plonegooglesitemaps package and Plone site 
    61 # with the default profile for the package 
    62 PRODUCT = 'quintagroup.plonegooglesitemaps' 
    63 ptc.installPackage(PRODUCT) 
    64 ptc.setupPloneSite( extension_profiles=("%s:default" % PRODUCT,)) 
    65  
    667 
    678class TestGoogleSitemapsInstallation(TestCase): 
Note: See TracChangeset for help on using the changeset viewer.