Skip to content

Commit

Permalink
Started fixing functional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Jan 12, 2005
1 parent 8bad910 commit c959b33
Show file tree
Hide file tree
Showing 6 changed files with 391 additions and 0 deletions.
69 changes: 69 additions & 0 deletions browser/ftests.py
@@ -0,0 +1,69 @@
##############################################################################
#
# 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.1 (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 API Documentation.
$Id$
"""
import unittest
from zope.app.testing.functional import BrowserTestCase

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

def testMenu(self):
response = self.publish('/++apidoc++/menu.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Click on one of the Documentation') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/menu.html',
basic='mgr:mgrpw')


def testIndexView(self):
response = self.publish('/++apidoc++/index.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Zope 3 API Documentation') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/index.html',
basic='mgr:mgrpw')

def testContentsView(self):
response = self.publish('/++apidoc++/contents.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('<h1>Zope 3 API Documentation</h1>') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/contents.html',
basic='mgr:mgrpw')

def testModuleListView(self):
response = self.publish('/++apidoc++/modulelist.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find(
'<a href="contents.html" target="main">Zope') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/modulelist.html',
basic='mgr:mgrpw')


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

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
91 changes: 91 additions & 0 deletions classmodule/ftests.py
@@ -0,0 +1,91 @@
##############################################################################
#
# 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.1 (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 Class Documentation Module.
$Id$
"""
import unittest
from zope.app.testing.functional import BrowserTestCase

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

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

def testMenuClassFinder(self):
response = self.publish('/++apidoc++/Class/menu.html',
basic='mgr:mgrpw',
form={'path': 'Class', 'SUBMIT': 'Find'})
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('zope.app.apidoc.classmodule.ClassModule') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/Class/menu.html',
basic='mgr:mgrpw')

def testModuleDetailsView(self):
response = self.publish('/++apidoc++/Class/zope/app/apidoc/',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Zope 3 API Documentation') > 0)
self.checkForBrokenLinks(body, '/++apidoc++/Class/zope/app/apidoc/',
basic='mgr:mgrpw')

def testClassDetailsView(self):
response = self.publish(
'/++apidoc++/Class/zope/app/apidoc/APIDocumentation',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Represent the complete API Documentation.') > 0)
self.checkForBrokenLinks(
body, '/++apidoc++/Class/zope/app/apidoc/APIDocumentation',
basic='mgr:mgrpw')

def testFunctionDetailsView(self):
response = self.publish(
'/++apidoc++/Class/zope/app/apidoc/handleNamespace',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('handleNamespace(ob, name)') > 0)
self.checkForBrokenLinks(
body, '/++apidoc++/Class/zope/app/apidoc/handleNamesapce',
basic='mgr:mgrpw')

def testZCMLFileDetailsView(self):
response = self.publish(
'/++apidoc++/Class/zope/app/configure.zcml',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.checkForBrokenLinks(
body, '/++apidoc++/Class/zope/app/configure.zcml',
basic='mgr:mgrpw')


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

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
59 changes: 59 additions & 0 deletions ifacemodule/ftests.py
@@ -0,0 +1,59 @@
##############################################################################
#
# 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.1 (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 Interface Documentation Module.
$Id$
"""
import unittest
from zope.app.testing.functional import BrowserTestCase

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

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

def testInterfaceDetailsView(self):
response = self.publish(
'/++apidoc++/Interface'
'/zope.app.apidoc.ifacemodule.IInterfaceModule'
'/apiindex.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Interface API Documentation Module') > 0)
self.checkForBrokenLinks(
body,
'/++apidoc++/Interface'
'/zope.app.apidoc.ifacemodule.IInterfaceModule'
'/apiindex.html',
basic='mgr:mgrpw')



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

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
57 changes: 57 additions & 0 deletions utilitymodule/ftests.py
@@ -0,0 +1,57 @@
##############################################################################
#
# 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.1 (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$
"""
import unittest
from zope.app.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')
64 changes: 64 additions & 0 deletions viewmodule/ftests.py
@@ -0,0 +1,64 @@
##############################################################################
#
# 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.1 (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 Presentation Documentation Module.
$Id$
"""
import unittest
from zope.app.testing.functional import BrowserTestCase

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

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


def testSkinsLayersView(self):
response = self.publish('/++apidoc++/Views/skin_layer.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('Skin-Layer Tree') > 0)

def testViewsDetails(self):
response = self.publish(
'/++apidoc++/Views/index.html',
form={'iface': 'zope.app.apidoc.interfaces.IDocumentationModule',
'type': 'zope.publisher.interfaces.browser.IBrowserRequest',
'all': 'all'},
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find(
'IBrowserRequest\n <span>views for</span>\n'
' IDocumentationModule') > 0)
self.checkForBrokenLinks(
body, '/++apidoc++/Views/index.html',
basic='mgr:mgrpw')


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

if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
51 changes: 51 additions & 0 deletions zcmlmodule/ftests.py
@@ -0,0 +1,51 @@
##############################################################################
#
# 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.1 (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 ZCML Documentation Module.
$Id$
"""
import unittest
from zope.app.testing.functional import BrowserTestCase

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

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

def testDirectiveDetailsView(self):
response = self.publish('/++apidoc++/ZCML/ALL/configure/index.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
body = response.getBody()
self.assert_(body.find('<i>all namespaces</i>') > 0)
self.checkForBrokenLinks(body,
'/++apidoc++/ZCML/ALL/configure/index.html',
basic='mgr:mgrpw')


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

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

0 comments on commit c959b33

Please sign in to comment.