Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/base.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/base.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/base.py	(revision 2534)
@@ -30,5 +30,5 @@
 
 
-class MixinTestCase:
+class MixinTestCase(object):
     """ Define layer and common afterSetup method with package installation.
         Package installation on plone site setup impossible because of
@@ -39,4 +39,5 @@
     def afterSetUp(self):
         self.loginAsPortalOwner()
+        self.workflow = self.portal.portal_workflow
 
 
@@ -44,6 +45,11 @@
     """ For unit tests """
 
+
 class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase):
     """ For functional tests """
+
+    def afterSetUp(self):
+        super(FunctionalTestCase, self).afterSetUp()
+        self.auth = "%s:%s" % (portal_owner, default_password)
 
 # Initialize all needed zcml directives
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testConfiglet.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testConfiglet.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testConfiglet.py	(revision 2534)
@@ -16,5 +16,4 @@
     def afterSetUp(self):
         super(TestConfigletSettings, self).afterSetUp()
-        self.auth = "%s:%s" % (portal_owner, default_password)
         self.settingsURL = '/'+self.portal.absolute_url(1) + '/prefs_gsm_settings'
 
@@ -70,5 +69,4 @@
     def afterSetUp(self):
         super(TestConfigletOverview, self).afterSetUp()
-        self.auth = "%s:%s" % (portal_owner, default_password)
         self.overviewURL = '/'+self.portal.absolute_url(1) + '/prefs_gsm_overview'
         self.smURL = "%s/sitemap.xml" % self.portal.absolute_url()
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testGoogleSitemaps.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testGoogleSitemaps.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testGoogleSitemaps.py	(revision 2534)
@@ -33,16 +33,11 @@
         super(TestGoogleSitemaps, self).afterSetUp()
 
-        self.workflow = self.portal.portal_workflow
-        self.auth = 'admin:admin'
         _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
         self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps'
-        self.portal.portal_membership.addMember('admin', 'admin', ('Manager',), [])
         self.gsm_props = self.portal.portal_properties['googlesitemap_properties']
 
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc')
-        self.my_doc = self.portal['my_doc']
+        self.my_doc = _createObjectByType('Document', self.portal, id='my_doc')
         self.my_doc.edit(text_format='plain', text='hello world')
-
 
     def testSitemap(self):
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testInstallation.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testInstallation.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testInstallation.py	(revision 2534)
@@ -59,6 +59,6 @@
     def afterSetUp(self):
         self.loginAsPortalOwner()
-        qi = self.portal.portal_quickinstaller
-        qi.uninstallProducts(products=['quintagroup.plonegooglesitemaps',])
+        self.portal.portal_quickinstaller.uninstallProducts(
+            products=['quintagroup.plonegooglesitemaps',])
         self._refreshSkinData()
 
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testMobileSitemaps.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testMobileSitemaps.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testMobileSitemaps.py	(revision 2534)
@@ -29,10 +29,9 @@
         # Add testing mobile item to portal
         self.pubdate = (DateTime()+1).strftime("%Y-%m-%d")
-        my_mobile = self.portal.invokeFactory("Document", id="my_mobile")
-        self.my_mobile = self.portal["my_mobile"]
+        self.my_mobile = _createObjectByType('Document', self.portal, id='my_mobile')
         alsoProvides(self.my_mobile, IMobileMarker)
         self.my_mobile.edit(text="Test mobile item", title="First mobile (test)",
                             effectiveDate=self.pubdate)
-        self.portal.portal_workflow.doActionFor(self.my_mobile, "publish")
+        self.workflow.doActionFor(self.my_mobile, "publish")
         self.reParse()
 
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testNewsSitemaps.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testNewsSitemaps.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testNewsSitemaps.py	(revision 2534)
@@ -17,10 +17,9 @@
         # Add testing news item to portal
         self.pubdate = (DateTime()+1).strftime("%Y-%m-%d")
-        my_news = self.portal.invokeFactory("News Item", id="my_news")
-        self.my_news = self.portal["my_news"]
+        self.my_news = _createObjectByType('News Item', self.portal, id='my_news')
         self.my_news.edit(text="Test news item", title="First news (test)", language="ua",
                           effectiveDate=self.pubdate, gsm_access="Registration",
                           gsm_genres=("PressRelease",), gsm_stock="NASDAQ:AMAT, BOM:500325")
-        self.portal.portal_workflow.doActionFor(self.my_news, "publish")
+        self.workflow.doActionFor(self.my_news, "publish")
         self.reParse()
 
@@ -91,8 +90,9 @@
     def test_ngenresForNotExtended(self):
         # No genres should present for not extended content type
-        self.portal.invokeFactory("Document", id="my_doc")
-        my_doc = getattr(self.portal, "my_doc")
+        my_doc = _createObjectByType('Document', self.portal, id='my_doc')
+        #self.portal.invokeFactory("Document", id="my_doc")
+        #my_doc = getattr(self.portal, "my_doc")
         my_doc.edit(text="Test document")
-        self.portal.portal_workflow.doActionFor(my_doc, "publish")
+        self.workflow.doActionFor(my_doc, "publish")
         self.portal["news-sitemaps"].edit(portalTypes=("Document",))
         self.reParse()
@@ -116,8 +116,7 @@
         # Add minimal testing news item to portal
         self.pubdate = (DateTime()+1).strftime("%Y-%m-%d")
-        my_news = self.portal.invokeFactory("News Item", id="my_news")
-        self.my_news = self.portal["my_news"]
+        self.my_news = _createObjectByType('News Item', self.portal, id='my_news')
         self.my_news.edit(effectiveDate=self.pubdate)
-        self.portal.portal_workflow.doActionFor(self.my_news, "publish")
+        self.workflow.doActionFor(self.my_news, "publish")
         self.reParse()
 
@@ -168,10 +167,6 @@
     def afterSetUp(self):
         super(TestSchemaExtending, self).afterSetUp()
-        self.loginAsPortalOwner()
-        # Add testing news item to portal
-        my_news = self.portal.invokeFactory("News Item", id="my_news")
-        self.my_news = self.portal["my_news"]
-        my_doc = self.portal.invokeFactory("Document", id="my_doc")
-        self.my_doc = self.portal["my_doc"]
+        self.my_doc = _createObjectByType('Document', self.portal, id='my_doc')
+        self.my_news = _createObjectByType('News Item', self.portal, id='my_news')
 
     def testExtendNewsItemByDefault(self):
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testPinging.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testPinging.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testPinging.py	(revision 2534)
@@ -7,11 +7,7 @@
     def afterSetUp(self):
         super(TestPinging, self).afterSetUp()
-
-        self.workflow = self.portal.portal_workflow
         self.workflow.setChainForPortalTypes(pt_names=('News Item','Document'),
                                              chain="simple_publication_workflow")
         self.gsm_props = self.portal.portal_properties['googlesitemap_properties']
-        self.auth = 'admin:admin'
-        self.portal.portal_membership.addMember('admin', 'admin', ('Manager',), [])
         # Add sitemaps
         self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
@@ -22,8 +18,6 @@
         self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps'
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc')
-        self.my_doc = self.portal['my_doc']
-        my_news = self.portal.invokeFactory('News Item', id='my_news')
-        self.my_news = self.portal['my_news']
+        self.my_doc = _createObjectByType('Document', self.portal, id='my_doc')
+        self.my_news = _createObjectByType('News Item', self.portal, id='my_news')
 
     def testAutomatePinging(self):
Index: /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testSitemaps.py
===================================================================
--- /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testSitemaps.py	(revision 2533)
+++ /quintagroup.plonegooglesitemaps/branches/test_refactoring/quintagroup/plonegooglesitemaps/tests/testSitemaps.py	(revision 2534)
@@ -11,7 +11,5 @@
     def afterSetUp(self):
         super(TestSitemapType, self).afterSetUp()
-        self.auth = 'admin:admin'
         self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
-        self.portal.portal_membership.addMember('admin', 'admin', ('Manager',), [])
 
     def testFields(self):
@@ -54,5 +52,5 @@
 
     def txestPingSetting(self):
-        pwf = self.portal.portal_workflow['plone_workflow']
+        pwf = self.workflow['plone_workflow']
         self.assertEqual(self.contentSM.getPingTransitions(), ())
 
@@ -76,17 +74,9 @@
     def afterSetUp(self):
         super(TestSettings, self).afterSetUp()
-
-        self.workflow = self.portal.portal_workflow
         self.gsm_props = self.portal.portal_properties['googlesitemap_properties']
-        self.auth = 'admin:admin'
         self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
-
         self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps'
-
-        self.portal.portal_membership.addMember('admin', 'admin', ('Manager',), [])
-
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc')
-        self.my_doc = self.portal['my_doc']
+        self.my_doc = _createObjectByType('Document', self.portal, id='my_doc')
         self.my_doc.edit(text_format='plain', text='hello world')
         self.my_doc_url = self.my_doc.absolute_url()
@@ -157,11 +147,7 @@
     def afterSetUp(self):
         super(TestPinging, self).afterSetUp()
-
-        self.workflow = self.portal.portal_workflow
         self.workflow.setChainForPortalTypes(pt_names=('News Item','Document'),
                                              chain="simple_publication_workflow")
         self.gsm_props = self.portal.portal_properties['googlesitemap_properties']
-        self.auth = 'admin:admin'
-        self.portal.portal_membership.addMember('admin', 'admin', ('Manager',), [])
         # Add sitemaps
         self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
@@ -172,8 +158,6 @@
         self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps'
         # Add testing document to portal
-        my_doc = self.portal.invokeFactory('Document', id='my_doc')
-        self.my_doc = self.portal['my_doc']
-        my_news = self.portal.invokeFactory('News Item', id='my_news')
-        self.my_news = self.portal['my_news']
+        self.my_doc = _createObjectByType('Document', self.portal, id='my_doc')
+        self.my_news = _createObjectByType('News Item', self.portal, id='my_news')
 
     def testAutomatePinging(self):
