Skip to content.

Etria Lists

 

[quills-dev] [Collective-checkins] r49766 - Quills/trunk/tests

quills-dev at lists.etria.com quills-dev at lists.etria.com
Thu Sep 20 15:17:55 UTC 2007


Author: tomster
Date: Thu Sep 20 15:17:55 2007
New Revision: 49766

Modified:
   Quills/trunk/tests/base.py
   Quills/trunk/tests/browser.rst
   Quills/trunk/tests/test_quills.py
Log:
adding a failing test to illustrate the problem i'm currently facing. the browsertest fails, because for some reason the test setup doesn't register the skin path `Quills` (and thus doesn't find the weblog_macros etc.)

While debugging this I came up with a setup test, that narrows the problem down.

Modified: Quills/trunk/tests/base.py
==============================================================================
--- Quills/trunk/tests/base.py	(original)
+++ Quills/trunk/tests/base.py	Thu Sep 20 15:17:55 2007
@@ -6,6 +6,13 @@
 
 from Testing import ZopeTestCase
 from Products.Five.testbrowser import Browser as BaseBrowser
+from transaction import commit
+from AccessControl.SecurityManagement import newSecurityManager
+
+from Products.Five import zcml
+
+# CMFCore imports
+from Products.CMFCore.utils import getToolByName
 
 # Let Zope know about Quills
 ZopeTestCase.installProduct('ATTrackback')
@@ -14,10 +21,33 @@
 # Import PloneTestCase - this registers more products with Zope as a side effect
 from Products.PloneTestCase import PloneTestCase
 from Products.PloneTestCase.PloneTestCase import setupPloneSite
+from Products.PloneTestCase.layer import PloneSite
+
+import quills.core
+import quills.app
 
 # Set up a Plone site, and apply the Quills extension profile
 setupPloneSite(products=['Quills', 'ATTrackback'])
 
+class QuillsSite(PloneSite):
+
+    @classmethod
+    def setUp(cls):
+        app = ZopeTestCase.app()
+        portal = app.plone
+        # login as admin (copied from `loginAsPortalOwner`)
+        uf = app.acl_users
+        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
+        newSecurityManager(None, user)
+        zcml.load_config('configure.zcml', quills.core)
+        zcml.load_config('configure.zcml', quills.app)
+        setup_tool = getToolByName(portal, 'portal_setup')
+        setup_tool.runAllImportStepsFromProfile('quills.core')        
+        setup_tool.runAllImportStepsFromProfile('quills.app')        
+
+        commit()
+        ZopeTestCase.close(app)
+
 
 class Browser(BaseBrowser):
 
@@ -51,10 +81,14 @@
     methods.
     """
 
+    layer = PloneSite
+
 
 class QuillsFunctionalTestCase(QuillsTestCaseMixin, PloneTestCase.FunctionalTestCase):
     """ a class for running functional tests."""
 
+    layer = QuillsSite
+
 
 class QuillsDocTestCase(QuillsTestCaseMixin, PloneTestCase.PloneTestCase):
     """Base class for integration tests for the 'Quills' product. This may
@@ -62,6 +96,8 @@
     methods.
     """
 
+    layer = PloneSite
+
 
 class QuillsContributorDocTestCase(QuillsDocTestCase):
     """As QuillsDocTestCase, but only gives the logged-in user the 'Contributor'

Modified: Quills/trunk/tests/browser.rst
==============================================================================
--- Quills/trunk/tests/browser.rst	(original)
+++ Quills/trunk/tests/browser.rst	Thu Sep 20 15:17:55 2007
@@ -6,4 +6,4 @@
     >>> self.setRoles(("Manager",))
     >>> browser = self.getBrowser(logged_in=True)
     >>> browser.handleErrors = False
-    >>> browser.open('http://nohost/plone/weblog/folder_contents')
+    >>> browser.open('http://nohost/plone/weblog/')

Modified: Quills/trunk/tests/test_quills.py
==============================================================================
--- Quills/trunk/tests/test_quills.py	(original)
+++ Quills/trunk/tests/test_quills.py	Thu Sep 20 15:17:55 2007
@@ -38,12 +38,18 @@
         self.folder.weblog.invokeFactory("WeblogEntry", id="entry")
         self.failUnless("entry" in self.folder.weblog.objectIds())
 
+class TestSetup(QuillsTestCase):
+    """check for various setup issues"""
 
+    def testSkinLayersInstalled(self):
+        self.failUnless('Quills' in self.portal.portal_skins.objectIds())
+        
 def test_suite():
     from unittest import TestSuite, makeSuite
     suite = TestSuite()
     suite.addTest(makeSuite(TestPortalTypes))
     suite.addTest(makeSuite(TestFolderContainment))
+    suite.addTest(makeSuite(TestSetup))
     return suite
 
 #if __name__ == '__main__':

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Collective-checkins mailing list
Collective-checkins at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/collective-checkins



More information about the quills-dev mailing list