[CMF-checkins] CVS: CMF - __init__.py:1.1 test_AllCMFDefault.py:1.1 test_utils.py:1.3
Jeffrey Shell
jeffrey@digicool.com
Thu, 29 Mar 2001 10:59:26 -0500 (EST)
Update of /cvs-repository/CMF/CMFDefault/tests
In directory korak:/home/jeffrey/InstanceHomes/cmf-dev/CMF/CMFDefault/tests
Modified Files:
test_utils.py
Added Files:
__init__.py test_AllCMFDefault.py
Log Message:
Updated test_utils to follow pattern used in CMFTopic, which also allows for test_AllCMFDefault to merge all of the test suites into one.
--- Added File __init__.py in package CMF ---
"""\
Unit test package for CMFDefault.
As test suites are added, they should be added to the
mega-test-suite in test_AllCMFDefault.py
"""
--- Added File test_AllCMFDefault.py in package CMF ---
import unittest
from Products.CMFDefault.tests import test_Document, test_utils
def main():
"""\
Combines all of the test suites in this package into a single
large test.
"""
suite = unittest.TestSuite((
test_Document.test_suite(),
test_utils.test_suite(),
))
unittest.TextTestRunner().run(suite)
if __name__ == '__main__':
main()
--- Updated File test_utils.py in package CMF --
--- test_utils.py 2001/03/22 21:29:47 1.2
+++ test_utils.py 2001/03/29 15:59:25 1.3
@@ -2,9 +2,7 @@
from Products.CMFDefault.utils import parseHeadersBody
from string import split
-class TestCase( unittest.TestCase ):
- """
- """
+class DefaultUtilsTests(unittest.TestCase):
COMMON_HEADERS = '''Author: Tres Seaver
Title: Test Products.PTKDemo.utils.parseHeadersBody'''
@@ -17,8 +15,7 @@
Header: value
'''
- def testNoBody( self ):
-
+ def test_NoBody( self ):
headers, body = parseHeadersBody( '%s\n\n' % self.COMMON_HEADERS )
assert( len( headers ) == 2, '%d!' % len( headers ) )
assert( 'Author' in headers.keys() )
@@ -26,7 +23,7 @@
assert( 'Title' in headers.keys() )
assert( len( body ) == 0, '%d!' % len( body ) )
- def testContinuation( self ):
+ def test_Continuation( self ):
headers, body = parseHeadersBody( '%s\n%s\n\n'
% ( self.COMMON_HEADERS
, self.MULTILINE_DESCRIPTION
@@ -38,7 +35,7 @@
assert( desc_len == 2, '%d!' % desc_len )
assert( len( body ) == 0, '%d!' % len( body ) )
- def testBody( self ):
+ def test_Body( self ):
headers, body = parseHeadersBody( '%s\n\n%s'
% ( self.COMMON_HEADERS
, self.TEST_BODY
@@ -47,7 +44,7 @@
assert( len( headers ) == 2, '%d!' % len( headers ) )
assert( body == self.TEST_BODY )
- def testPreload( self ):
+ def test_Preload( self ):
preloaded = { 'Author' : 'xxx', 'text_format' : 'structured_text' }
headers, body = parseHeadersBody( '%s\n%s\n\n%s'
% ( self.COMMON_HEADERS
@@ -60,12 +57,9 @@
assert( preloaded[ 'Author' ] != headers[ 'Author' ] )
assert( preloaded[ 'text_format' ] == headers[ 'text_format' ] )
+def test_suite():
+ return unittest.makeSuite(DefaultUtilsTests)
+
if __name__ == '__main__':
+ result = unittest.TextTestRunner().run(test_suite())
- import sys
- suite = unittest.makeSuite( TestCase )
- result = unittest.TextTestRunner().run( suite )
- if result.wasSuccessful():
- sys.exit(0)
- else:
- sys.exit(1)