[Zope3-checkins]
CVS: Zope3/src/zope/products/codecontent/browser/tests
- __init__.py:1.1.2.1 test_dtmlpageeval.py:1.1.2.1
test_sqladd.py:1.1.2.1 test_zptpageeval.py:1.1.2.1
Philipp von Weitershausen
philikon at philikon.de
Sun Feb 8 09:03:44 EST 2004
Update of /cvs-repository/Zope3/src/zope/products/codecontent/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv10229/products/codecontent/browser/tests
Added Files:
Tag: philikon-movecontent-branch
__init__.py test_dtmlpageeval.py test_sqladd.py
test_zptpageeval.py
Log Message:
Move zope.app.content,
zope.app.interfaces.content,
and zope.app.browser.content
to zope.products.content and zope.products.codecontent, respectively.
=== Added File Zope3/src/zope/products/codecontent/browser/tests/__init__.py ===
# make this directory a package
=== Added File Zope3/src/zope/products/codecontent/browser/tests/test_dtmlpageeval.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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
#
##############################################################################
"""DTML Page Evaluation Tests
$Id: test_dtmlpageeval.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
from unittest import TestCase, main, makeSuite
from zope.app.container.contained import contained
from zope.products.codecontent.browser.dtmlpageeval import DTMLPageEval
class Test(TestCase):
def test(self):
class Template:
def render(self, request, **kw):
self.called = request, kw
request.response.setHeader('content-type', self.content_type)
return 42
content_type = 'text/x-test'
class Folder: name='zope'
folder = Folder()
class Request(object):
def _getResponse(self):
return self
response = property(_getResponse)
def setHeader(self, name, value):
setattr(self, name, value)
request = Request()
template = contained(Template(), folder, 'foo')
view = DTMLPageEval()
# Do manually, since directive adds BrowserView as base class
view.context = template
view.request = request
self.assertEqual(view.index(request), 42)
self.assertEqual(template.called, (request, {}))
self.assertEqual(getattr(request, 'content-type'), 'text/x-test')
def test_suite():
return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')
=== Added File Zope3/src/zope/products/codecontent/browser/tests/test_sqladd.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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
#
##############################################################################
"""DTML Page Evaluation Tests
$Id: test_sqladd.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
import unittest, doctest
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite('zope.products.codecontent.browser.sql'),
))
if __name__ == '__main__': unittest.main()
=== Added File Zope3/src/zope/products/codecontent/browser/tests/test_zptpageeval.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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
#
##############################################################################
"""
Revision information:
$Id: test_zptpageeval.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
from unittest import TestCase, main, makeSuite
from zope.testing.cleanup import CleanUp # Base class w registry cleanup
from zope.app.container.contained import contained
from zope.products.codecontent.browser.zpt import ZPTPageEval
class Test(CleanUp, TestCase):
def testTemplateRendering(self):
class Template:
def render(self, request, **kw):
self.called = request, kw
return 42
content_type = 'text/x-test'
class Folder: name='zope'
folder = Folder()
class Request(object):
def _getResponse(self):
return self
response = property(_getResponse)
def setHeader(self, name, value):
setattr(self, name, value)
request = Request()
template = contained(Template(), folder)
view = ZPTPageEval()
# Do manually, since directive adds BrowserView as base class
view.context = template
view.request = request
self.assertEqual(view.index(), 42)
self.assertEqual(template.called, (request, {}))
self.assertEqual(getattr(request, 'content-type'), 'text/x-test')
def test_suite():
return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')
More information about the Zope3-Checkins
mailing list