Ignore:
Timestamp:
20 Jun 2011, 02:37:06 (15 years ago)
Author:
uli
Message:

Reorganize tests. For what is over, make most of the remaining accesscode stuff work again. Still lots to do.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py

    r6414 r6417  
    2020## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    2121##
     22import doctest
     23import os
     24import re
    2225import shutil
    2326import tempfile
    2427import unittest
     28
    2529from datetime import datetime
    2630from hurry.workflow.interfaces import InvalidTransitionError, IWorkflowState
    27 from zope.app.testing.functional import FunctionalTestCase
     31from zope.app.testing.functional import (
     32    FunctionalTestCase, FunctionalTestSetup, getRootFolder)
    2833from zope.component.hooks import setSite, clearSite
    2934from zope.interface.verify import verifyObject, verifyClass
     35from zope.testing import renormalizing
    3036from waeup.sirp.app import University
    3137from waeup.sirp.testing import FunctionalLayer
    … …  
    3844from waeup.sirp.accesscodes.workflow import INITIALIZED, USED, DISABLED
    3945
     46
     47
     48
    4049class AccessCodeHelpersTests(FunctionalTestCase):
    4150    # Tests for helpers like get_access_code, disable_accesscode, ...
    … …  
    261270        assert verifyObject(IAccessCodeBatchContainer, accesscodes)
    262271        assert verifyClass(IAccessCodeBatchContainer, AccessCodeBatchContainer)
     272
     273
     274checker = renormalizing.RENormalizing([
     275        (re.compile('[\d]{10}'), '<10-DIGITS>'),
     276        ])
     277
     278def setUp(test):
     279    FunctionalTestSetup().setUp()
     280
     281def tearDown(self, test=None):
     282    FunctionalTestSetup().tearDown()
     283
     284
     285
     286def test_suite():
     287    suite = unittest.TestSuite()
     288    for testcase in [
     289        AccessCodeHelpersTests,
     290        AccessCodeTests,
     291        AccessCodeBatchTests,
     292        AccessCodeBatchContainerTests,
     293        ]:
     294        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
     295    for filename in [
     296        #'accesscodes.txt',
     297        'browser.txt'
     298        ]:
     299        path = os.path.join(
     300            os.path.dirname(os.path.dirname(__file__)), filename)
     301        test = doctest.DocFileSuite(
     302            path,
     303            module_relative=False,
     304            setUp=setUp, tearDown=tearDown,
     305            globs = dict(getRootFolder = getRootFolder),
     306            optionflags = doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
     307            checker = checker,
     308            )
     309        test.layer = FunctionalLayer
     310        suite.addTest(test)
     311    return suite
Note: See TracChangeset for help on using the changeset viewer.