[Zope-Checkins] CVS: Packages/AccessControl/tests - framework.py:1.1.2.1 testSecurity.py:1.3.2.1

Evan Simpson evan@cvs.zope.org
Mon, 6 Aug 2001 13:16:41 -0400


Update of /cvs-repository/Packages/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv1419/AccessControl/tests

Modified Files:
      Tag: Zope-2_4-branch
	testSecurity.py 
Added Files:
      Tag: Zope-2_4-branch
	framework.py 
Log Message:
Added new unit test framework, changed several test suites to use it.


=== Added File Packages/AccessControl/tests/framework.py ===


=== Packages/AccessControl/tests/testSecurity.py 1.3 => 1.3.2.1 ===
 __version__='$Revision$'[11:-2]
 
-import sys, os
-import unittest
-
-if __name__=='__main__':
-    sys.path.append(os.path.join(os.pardir, os.pardir))
-    here = os.curdir
-else:
-    from App.Common import package_home
-    here = package_home(globals())
+import os, sys
+execfile(os.path.join(sys.path[0], 'framework.py'))
 
 import ZODB
 from DocumentTemplate import HTML
@@ -113,7 +106,7 @@
     doc_class = UnownedDTML
     unrestricted_doc_class = HTML
 
-    def checkNoImplicitAccess(self):
+    def testNoImplicitAccess(self):
         class person:
             name='Jim'
 
@@ -128,7 +121,7 @@
         else:
             assert 0, 'Did not protect class instance'
 
-    def checkExprExplicitDeny(self):
+    def testExprExplicitDeny(self):
         class myclass (Base):
             __roles__ = None  # Public
             somemethod__roles__ = ()  # Private
@@ -144,7 +137,7 @@
         else:
             assert 0, 'Did not deny attribute access'
 
-    def checkSecurityInSyntax(self):
+    def testSecurityInSyntax(self):
         '''
         Ensures syntax errors are thrown for an expr with restricted
         syntax.
@@ -167,25 +160,4 @@
         assert res == '10', res
 
     # Note: we need more tests!
-
-
-def test_suite():
-    return unittest.makeSuite(SecurityTests, 'check')
-
-def main():
-    alltests = test_suite()
-    runner = unittest.TextTestRunner()
-    runner.run(alltests)
-
-def debug():
-   test_suite().debug()
-
-def pdebug():
-    import pdb
-    pdb.run('debug()')
-
-if __name__=='__main__':
-    if len(sys.argv) > 1:
-        globals()[sys.argv[1]]()
-    else:
-        main()
+framework()