[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests - test_baseresponse.py:1.1 test_browserresponse.py:1.4 test_http.py:1.14
Viktorija Zaksiene
ryzaja@codeworks.lt
Fri, 25 Apr 2003 06:36:39 -0400
Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv11283/tests
Modified Files:
test_browserresponse.py test_http.py
Added Files:
test_baseresponse.py
Log Message:
Reset response state on exception views.
=== Added File Zope3/src/zope/publisher/tests/test_baseresponse.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.
#
##############################################################################
"""Tests for BaseResponse
$Id: test_baseresponse.py,v 1.1 2003/04/25 10:36:39 ryzaja Exp $
"""
from unittest import TestCase, TestSuite, main, makeSuite
from zope.publisher.base import BaseResponse
from zope.publisher.interfaces import IResponse
from zope.interface.verify import verifyObject
from StringIO import StringIO
class TestBaseResponse(TestCase):
def test_interface(self):
verifyObject(IResponse, BaseResponse(StringIO()))
def test_suite():
return TestSuite((
makeSuite(TestBaseResponse),
))
if __name__=='__main__':
main(defaultTest='test_suite')
=== Zope3/src/zope/publisher/tests/test_browserresponse.py 1.3 => 1.4 ===
--- Zope3/src/zope/publisher/tests/test_browserresponse.py:1.3 Sun Mar 2 13:09:03 2003
+++ Zope3/src/zope/publisher/tests/test_browserresponse.py Fri Apr 25 06:36:39 2003
@@ -21,10 +21,11 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.publisher.browser import BrowserResponse
from StringIO import StringIO
+from zope.interface.verify import verifyObject
# XXX Waaa need more tests
-class Test(TestCase):
+class TestBrowserResponse(TestCase):
def test_contentType_DWIM_in_setBody(self):
response = BrowserResponse(StringIO())
@@ -83,10 +84,19 @@
"text/plain")
)
+ def test_interface(self):
+ from zope.publisher.interfaces.http import IHTTPResponse
+ from zope.publisher.interfaces.http import IHTTPApplicationResponse
+ from zope.publisher.interfaces import IResponse
+ rp = BrowserResponse(StringIO())
+ verifyObject(IHTTPResponse, rp)
+ verifyObject(IHTTPApplicationResponse, rp)
+ verifyObject(IResponse, rp)
+
def test_suite():
return TestSuite((
- makeSuite(Test),
+ makeSuite(TestBrowserResponse),
))
if __name__=='__main__':
=== Zope3/src/zope/publisher/tests/test_http.py 1.13 => 1.14 ===
--- Zope3/src/zope/publisher/tests/test_http.py:1.13 Thu Apr 17 04:52:58 2003
+++ Zope3/src/zope/publisher/tests/test_http.py Fri Apr 25 06:36:39 2003
@@ -290,10 +290,25 @@
self.assertEquals(deduceServerURL(), 'http://example.com')
+class TestHTTPResponse(unittest.TestCase):
+
+ def testInterface(self):
+ from zope.publisher.http import HTTPResponse
+ from zope.publisher.interfaces.http import IHTTPResponse
+ from zope.publisher.interfaces.http import IHTTPApplicationResponse
+ from zope.publisher.interfaces import IResponse
+ rp = HTTPResponse(StringIO())
+ verifyObject(IHTTPResponse, rp)
+ verifyObject(IHTTPApplicationResponse, rp)
+ verifyObject(IResponse, rp)
+
+
def test_suite():
- loader = unittest.TestLoader()
- return loader.loadTestsFromTestCase(HTTPTests)
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(HTTPTests))
+ suite.addTest(unittest.makeSuite(TestHTTPResponse))
+ return suite
if __name__ == '__main__':
- unittest.TextTestRunner().run(test_suite())
+ unittest.main()