Index: intagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests.py
===================================================================
--- /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests.py	(revision 1618)
+++ 	(revision )
@@ -1,53 +1,0 @@
-import unittest
-
-from zope.testing import doctestunit
-from zope.component import testing
-from Testing import ZopeTestCase as ztc
-
-from Products.Five import zcml
-from Products.Five import fiveconfigure
-from Products.PloneTestCase import PloneTestCase as ptc
-from Products.PloneTestCase.layer import PloneSite
-ptc.setupPloneSite()
-
-import quintagroup.plonegooglesitemaps
-
-class TestCase(ptc.PloneTestCase):
-    class layer(PloneSite):
-        @classmethod
-        def setUp(cls):
-            fiveconfigure.debug_mode = True
-            ztc.installPackage(quintagroup.plonegooglesitemaps)
-            fiveconfigure.debug_mode = False
-
-        @classmethod
-        def tearDown(cls):
-            pass
-
-
-def test_suite():
-    return unittest.TestSuite([
-
-        # Unit tests
-        #doctestunit.DocFileSuite(
-        #    'README.txt', package='quintagroup.plonegooglesitemaps',
-        #    setUp=testing.setUp, tearDown=testing.tearDown),
-
-        #doctestunit.DocTestSuite(
-        #    module='quintagroup.plonegooglesitemaps.mymodule',
-        #    setUp=testing.setUp, tearDown=testing.tearDown),
-
-
-        # Integration tests that use PloneTestCase
-        #ztc.ZopeDocFileSuite(
-        #    'README.txt', package='quintagroup.plonegooglesitemaps',
-        #    test_class=TestCase),
-
-        #ztc.FunctionalDocFileSuite(
-        #    'browser.txt', package='quintagroup.plonegooglesitemaps',
-        #    test_class=TestCase),
-
-        ])
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')
Index: intagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/framework.py
===================================================================
--- /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/framework.py	(revision 1618)
+++ 	(revision )
@@ -1,107 +1,0 @@
-##############################################################################
-#
-# ZopeTestCase 
-#
-# COPY THIS FILE TO YOUR 'tests' DIRECTORY.
-#
-# This version of framework.py will use the SOFTWARE_HOME
-# environment variable to locate Zope and the Testing package.
-#
-# If the tests are run in an INSTANCE_HOME installation of Zope,
-# Products.__path__ and sys.path with be adjusted to include the
-# instance's Products and lib/python directories respectively.
-#
-# If you explicitly set INSTANCE_HOME prior to running the tests,
-# auto-detection is disabled and the specified path will be used 
-# instead.
-#
-# If the 'tests' directory contains a custom_zodb.py file, INSTANCE_HOME
-# will be adjusted to use it.
-#
-# If you set the ZEO_INSTANCE_HOME environment variable a ZEO setup 
-# is assumed, and you can attach to a running ZEO server (via the 
-# instance's custom_zodb.py).
-#
-##############################################################################
-#
-# The following code should be at the top of every test module:
-#
-# import os, sys
-# if __name__ == '__main__':
-#     execfile(os.path.join(sys.path[0], 'framework.py'))
-#
-# ...and the following at the bottom:
-#
-# if __name__ == '__main__':
-#     framework()
-#
-##############################################################################
-
-__version__ = '0.2.3'
-
-# Save start state
-#
-__SOFTWARE_HOME = os.environ.get('SOFTWARE_HOME', '')
-__INSTANCE_HOME = os.environ.get('INSTANCE_HOME', '')
-
-if __SOFTWARE_HOME.endswith(os.sep):
-    __SOFTWARE_HOME = os.path.dirname(__SOFTWARE_HOME)
-
-if __INSTANCE_HOME.endswith(os.sep):
-    __INSTANCE_HOME = os.path.dirname(__INSTANCE_HOME)
-
-# Find and import the Testing package
-#
-if not sys.modules.has_key('Testing'):
-    p0 = sys.path[0]
-    if p0 and __name__ == '__main__':
-        os.chdir(p0)
-        p0 = ''
-    s = __SOFTWARE_HOME
-    p = d = s and s or os.getcwd()
-    while d:
-        if os.path.isdir(os.path.join(p, 'Testing')):
-            zope_home = os.path.dirname(os.path.dirname(p))
-            sys.path[:1] = [p0, p, zope_home]
-            break
-        p, d = s and ('','') or os.path.split(p)
-    else:
-        print 'Unable to locate Testing package.',
-        print 'You might need to set SOFTWARE_HOME.'
-        sys.exit(1)
-
-import Testing, unittest
-execfile(os.path.join(os.path.dirname(Testing.__file__), 'common.py'))
-
-# Include ZopeTestCase support
-#
-if 1:   # Create a new scope
-
-    p = os.path.join(os.path.dirname(Testing.__file__), 'ZopeTestCase')
-
-    if not os.path.isdir(p):
-        print 'Unable to locate ZopeTestCase package.',
-        print 'You might need to install ZopeTestCase.'
-        sys.exit(1)
-
-    ztc_common = 'ztc_common.py'
-    ztc_common_global = os.path.join(p, ztc_common)
-
-    f = 0
-    if os.path.exists(ztc_common_global):
-        execfile(ztc_common_global)
-        f = 1
-    if os.path.exists(ztc_common):
-        execfile(ztc_common)
-        f = 1
-
-    if not f:
-        print 'Unable to locate %s.' % ztc_common
-        sys.exit(1)
-
-# Debug
-#
-print 'SOFTWARE_HOME: %s' % os.environ.get('SOFTWARE_HOME', 'Not set')
-print 'INSTANCE_HOME: %s' % os.environ.get('INSTANCE_HOME', 'Not set')
-sys.stdout.flush()
-
Index: intagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/runalltests.py
===================================================================
--- /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/runalltests.py	(revision 1618)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Runs all tests in the current directory
-#
-# Execute like:
-#   python runalltests.py
-#
-# Alternatively use the testrunner: 
-#   python /path/to/Zope/utilities/testrunner.py -qa
-#
-
-import os, sys
-if __name__ == '__main__':
-    execfile(os.path.join(sys.path[0], 'framework.py')) 
-
-import unittest
-TestRunner = unittest.TextTestRunner
-suite = unittest.TestSuite()
-
-tests = os.listdir(os.curdir)
-tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
-
-for test in tests:
-    m = __import__(test)
-    if hasattr(m, 'test_suite'):
-        suite.addTest(m.test_suite())
-
-if __name__ == '__main__':
-    TestRunner().run(suite)
-
Index: /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testqPloneGoogleSitemaps.py
===================================================================
--- /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testqPloneGoogleSitemaps.py	(revision 1618)
+++ /quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testqPloneGoogleSitemaps.py	(revision 1619)
@@ -1,36 +1,66 @@
 #
-# Tests for qPloneGoogleSitemaps
+# Tests for quintagroup.plonegooglesitemaps
 #
+
 import re, sys
 from urllib import urlencode
 from StringIO import StringIO
+import unittest
+
+from zope.testing import doctestunit
+from zope.component import testing
+from Testing import ZopeTestCase as ztc
 
 from Products.Five import zcml
 from Products.Five import fiveconfigure
-from Products.PloneTestCase import PloneTestCase
-
+
+from Products.PloneTestCase import PloneTestCase as ptc
+from Products.PloneTestCase.layer import PloneSite
 from Products.CMFPlone.utils import _createObjectByType
+
+from XMLParser import parse, hasURL
 
 import quintagroup.plonegooglesitemaps
 from quintagroup.plonegooglesitemaps.config import ping_googlesitemap
 
-from XMLParser import parse, hasURL
 quintagroup.plonegooglesitemaps.config.testing = 1
 
-PRODUCT = 'qPloneGoogleSitemaps'
-PRODUCTS = (PRODUCT,)
-
-# Import configure.zcml for qPloneGoogleSitemaps
+class MixinTestCase:
+    """ Define layer and common afterSetup method with package installation.
+        Package installation on plone site setup impossible because of
+        five's registerPackage directive not recognized on module initializing.
+    """
+    layer = PloneSite
+
+    def afterSetUp(self):
+        self.loginAsPortalOwner()
+
+
+class TestCase(MixinTestCase, ptc.PloneTestCase):
+    """ For unit tests """
+
+class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
+    """ For functional tests """
+
+# Initialize all needed zcml directives
 fiveconfigure.debug_mode = True
+from Products import Five, CMFCore, GenericSetup
+zcml.load_config('meta.zcml', Five)
+zcml.load_config('meta.zcml', CMFCore)
+zcml.load_config('meta.zcml', GenericSetup)
+zcml.load_config('permissions.zcml', Five)
+
+# Force quintagroup.plonegooglesitemaps zcml initialization
 zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
 fiveconfigure.debug_mode = False
 
-PloneTestCase.installProduct(PRODUCT)
-PloneTestCase.setupPloneSite(extension_profiles=("Products.%s:default" % PRODUCT,))
-
-class TestqPloneGoogleSitemapsInstallation(PloneTestCase.PloneTestCase):
-
-    def afterSetUp(self):
-        self.loginAsPortalOwner()
+# Install quintagroup.plonegooglesitemaps package and Plone site
+# with the default profile for the package
+PRODUCT = 'quintagroup.plonegooglesitemaps'
+ptc.installPackage(PRODUCT)
+ptc.setupPloneSite( extension_profiles=("%s:default" % PRODUCT,))
+
+
+class TestGoogleSitemapsInstallation(TestCase):
 
     def testType(self):
@@ -66,13 +96,13 @@
     def testSkins(self):
         ps = self.portal.portal_skins
-        self.assert_('qPloneGoogleSitemaps' in ps.objectIds(), 
-            'No "qPloneGoogleSitemaps" skin layer in portal_skins')
-        self.assert_('qPloneGoogleSitemaps' in ps.getSkinPath(ps.getDefaultSkin()),
-            'No "qPloneGoogleSitemaps" skin layer in default skin')
+        self.assert_('plonegooglesitemaps' in ps.objectIds(), 
+            'No "plonegooglesitemaps" skin layer in portal_skins')
+        self.assert_('plonegooglesitemaps' in ps.getSkinPath(ps.getDefaultSkin()),
+            'No "plonegooglesitemaps" skin layer in default skin')
 
     def testConfiglet(self):
         cp = self.portal.portal_controlpanel
-        self.assert_([1 for ai in cp.listActionInfos() if ai['id']=='qPloneGoogleSitemaps'], 
-            'No "qPloneGoogleSitemaps" configlet added to plone control panel')
+        self.assert_([1 for ai in cp.listActionInfos() if ai['id']=='GoogleSitemaps'], 
+            'No "GoogleSitemaps" configlet added to plone control panel')
 
     def testCatalog(self):
@@ -82,8 +112,8 @@
 
 
-class TestSitemapType(PloneTestCase.FunctionalTestCase):
+class TestSitemapType(FunctionalTestCase):
 
     def afterSetUp(self):
-        self.loginAsPortalOwner()
+        super(TestSitemapType, self).afterSetUp()
         self.auth = 'admin:admin'
         self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
@@ -137,8 +167,8 @@
 
 
-class TestqPloneGoogleSitemaps(PloneTestCase.FunctionalTestCase):
+class TestGoogleSitemaps(FunctionalTestCase):
 
     def afterSetUp(self):
-        self.loginAsPortalOwner()
+        super(TestGoogleSitemaps, self).afterSetUp()
 
         self.workflow = self.portal.portal_workflow
@@ -234,8 +264,8 @@
 
 
-class TestSettings(PloneTestCase.FunctionalTestCase):
+class TestSettings(FunctionalTestCase):
 
     def afterSetUp(self):
-        self.loginAsPortalOwner()
+        super(TestSettings, self).afterSetUp()
 
         self.workflow = self.portal.portal_workflow
@@ -315,8 +345,8 @@
 
 
-class TestPinging(PloneTestCase.FunctionalTestCase):
+class TestPinging(FunctionalTestCase):
 
     def afterSetUp(self):
-        self.loginAsPortalOwner()
+        super(TestPinging, self).afterSetUp()
 
         self.workflow = self.portal.portal_workflow
@@ -386,12 +416,12 @@
     from unittest import TestSuite, makeSuite
     suite = TestSuite()
-    suite.addTest(makeSuite(TestqPloneGoogleSitemapsInstallation))
+    suite.addTest(makeSuite(TestGoogleSitemapsInstallation))
     suite.addTest(makeSuite(TestSitemapType))
-    suite.addTest(makeSuite(TestqPloneGoogleSitemaps))
+    suite.addTest(makeSuite(TestGoogleSitemaps))
     suite.addTest(makeSuite(TestSettings))
     suite.addTest(makeSuite(TestPinging))
-
     return suite
 
 if __name__ == '__main__':
-    framework()
+    unittest.main(defaultTest='test_suite')
+#    framework()
