[Zope3-checkins] CVS: Zope3/src/zope/app/apidoc/utilitymodule - ftests.py:1.1 tests.py:1.3

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Mar 28 18:41:36 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/apidoc/utilitymodule
In directory cvs.zope.org:/tmp/cvs-serv23146/src/zope/app/apidoc/utilitymodule

Modified Files:
	tests.py 
Added Files:
	ftests.py 
Log Message:


Added tests.




=== Added File Zope3/src/zope/app/apidoc/utilitymodule/ftests.py ===
##############################################################################
#
# Copyright (c) 2003, 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Functional Tests for Utility Documentation Module.

$Id: ftests.py,v 1.1 2004/03/28 23:41:35 srichter Exp $
"""
import unittest
from zope.testing.functional import BrowserTestCase

class UtilityModuleTests(BrowserTestCase):
    """Just a couple of tests ensuring that the templates render."""

    def testMenu(self):
        response = self.publish(
            '/++apidoc++/Utility/menu.html', 
            basic='mgr:mgrpw')
        self.assertEqual(response.getStatus(), 200)
        body = response.getBody()
        self.assert_(body.find('IDocumentationModule') > 0)
        self.checkForBrokenLinks(body, '/++apidoc++/Utility/menu.html',
                                 basic='mgr:mgrpw')

    def testUtilityDetailsView(self):
        response = self.publish(
            '/++apidoc++/Utility/'
            'zope.app.apidoc.interfaces.IDocumentationModule/'
            'Class/index.html',
            basic='mgr:mgrpw')
        self.assertEqual(response.getStatus(), 200)
        body = response.getBody()
        self.assert_(body.find('zope.app.apidoc.classmodule.ClassModule') > 0)
        self.checkForBrokenLinks(
            body,
            '/++apidoc++/Utility/'
            'zope.app.apidoc.interfaces.IDocumentationModule/'
            'Class/index.html',
            basic='mgr:mgrpw')


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(UtilityModuleTests),
        ))

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')


=== Zope3/src/zope/app/apidoc/utilitymodule/tests.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/apidoc/utilitymodule/tests.py:1.2	Sat Mar 13 16:03:02 2004
+++ Zope3/src/zope/app/apidoc/utilitymodule/tests.py	Sun Mar 28 18:41:35 2004
@@ -18,16 +18,24 @@
 import unittest
 
 from zope.interface import implements
+from zope.publisher.browser import TestRequest
 from zope.testing.doctestunit import DocTestSuite
 
 from zope.app import zapi
-from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.location import LocationProxy
-from zope.app.tests import placelesssetup
+from zope.app.tests import placelesssetup, ztapi
 
+from zope.app.apidoc.interfaces import IDocumentationModule
+from zope.app.apidoc.tests import Root
 from zope.app.apidoc.ifacemodule import InterfaceModule
 from zope.app.apidoc.classmodule import ClassModule
-from zope.app.apidoc.interfaces import IDocumentationModule
+from zope.app.apidoc.utilitymodule import UtilityModule, Utility
+from browser import UtilityDetails
+
+from zope.app.tree.interfaces import IUniqueId
+from zope.app.tree.adapters import LocationUniqueId 
+
+from zope.app.traversing.interfaces import IPhysicallyLocatable
+from zope.app.location import LocationPhysicallyLocatable
 
 
 def setUp():
@@ -36,22 +44,30 @@
     service.provideUtility(IDocumentationModule, InterfaceModule(), '')
     service.provideUtility(IDocumentationModule, ClassModule(), 'Classes')
 
-def tearDown():
-    placelesssetup.tearDown()
+    ztapi.provideAdapter(None, IUniqueId, LocationUniqueId)
+    ztapi.provideAdapter(None, IPhysicallyLocatable,
+                         LocationPhysicallyLocatable)
 
 
-class Root:
-    implements(IContainmentRoot)
+def tearDown():
+    placelesssetup.tearDown()
 
-    __parent__ = None
-    __name__ = ''
+def getDetailsView():
+    utils = UtilityModule()
+    utils.__parent__ = Root
+    utils.__name__ = 'Utility'
+    util = Utility(utils, 'Classes', IDocumentationModule, ClassModule())
+    details = UtilityDetails()
+    details.context = util
+    details.request = TestRequest()
+    return details
 
-def rootLocation(obj, name):
-    return LocationProxy(obj, Root(), name)
-    
 def test_suite():
     return unittest.TestSuite((
-        DocTestSuite('zope.app.apidoc.utilitymodule'),
+        DocTestSuite('zope.app.apidoc.utilitymodule',
+                     setUp=setUp, tearDown=tearDown),
+        DocTestSuite('zope.app.apidoc.utilitymodule.browser',
+                     setUp=setUp, tearDown=tearDown),
         ))
 
 if __name__ == '__main__':




More information about the Zope3-Checkins mailing list