Commit 2346e30c authored by Guido van Rossum's avatar Guido van Rossum

Enforce the rule that unit tests have no docstrings.

Reduced the size of the password in testLongPassword() so that that
test doesn't take a minute or more.
parent 06566737
...@@ -21,7 +21,7 @@ class ClassSecurityInfoTests(unittest.TestCase): ...@@ -21,7 +21,7 @@ class ClassSecurityInfoTests(unittest.TestCase):
def testSetPermissionDefault(self): def testSetPermissionDefault(self):
"""Test setting default roles for permissions.""" # Test setting default roles for permissions.
# Setup a test class with default role -> permission decls. # Setup a test class with default role -> permission decls.
class Test(Folder): class Test(Folder):
......
...@@ -16,8 +16,8 @@ To be removed together with the API in due time. ...@@ -16,8 +16,8 @@ To be removed together with the API in due time.
""" """
__rcs_id__='$Id: testDeprecatedAPI.py,v 1.4 2002/08/14 21:28:08 mj Exp $' __rcs_id__='$Id: testDeprecatedAPI.py,v 1.5 2003/01/27 22:55:27 gvanrossum Exp $'
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
import ZODB # Sigh. Persistent needs to be set, so we import ZODB. import ZODB # Sigh. Persistent needs to be set, so we import ZODB.
from AccessControl import User from AccessControl import User
...@@ -30,7 +30,7 @@ class DeprecatedAPI(unittest.TestCase): ...@@ -30,7 +30,7 @@ class DeprecatedAPI(unittest.TestCase):
module='AccessControl') module='AccessControl')
def testDeprecatedHasRole(self): def testDeprecatedHasRole(self):
"""hasRole has been deprecated, we expect a warning.""" # hasRole has been deprecated, we expect a warning.
try: try:
self.userObject.hasRole(None) self.userObject.hasRole(None)
except DeprecationWarning: except DeprecationWarning:
...@@ -39,7 +39,7 @@ class DeprecatedAPI(unittest.TestCase): ...@@ -39,7 +39,7 @@ class DeprecatedAPI(unittest.TestCase):
self.fail('Expected DeprecationWarning, none given') self.fail('Expected DeprecationWarning, none given')
def testAllowed(self): def testAllowed(self):
"""hasRole is an alias for allowed, which should be unaffected.""" # hasRole is an alias for allowed, which should be unaffected.
try: try:
self.userObject.allowed(None) self.userObject.allowed(None)
except DeprecationWarning: except DeprecationWarning:
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"""Test of AuthEncoding """Test of AuthEncoding
""" """
__rcs_id__='$Id: testPasswordDigest.py,v 1.4 2002/08/14 21:28:08 mj Exp $' __rcs_id__='$Id: testPasswordDigest.py,v 1.5 2003/01/27 22:55:27 gvanrossum Exp $'
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
import os, sys, unittest import os, sys, unittest
...@@ -57,7 +57,7 @@ class PasswordDigestTests (unittest.TestCase): ...@@ -57,7 +57,7 @@ class PasswordDigestTests (unittest.TestCase):
assert not AuthEncoding.pw_validate(enc, 'xxx') assert not AuthEncoding.pw_validate(enc, 'xxx')
def testLongPassword(self): def testLongPassword(self):
pw = 'Pw' * 10000 pw = 'Pw' * 2000
for id in AuthEncoding.listSchemes(): for id in AuthEncoding.listSchemes():
enc = AuthEncoding.pw_encrypt(pw, id) enc = AuthEncoding.pw_encrypt(pw, id)
assert enc != pw assert enc != pw
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"""Document Template Tests """Document Template Tests
""" """
__rcs_id__='$Id: testSecurity.py,v 1.10 2002/08/14 21:28:08 mj Exp $' __rcs_id__='$Id: testSecurity.py,v 1.11 2003/01/27 22:55:27 gvanrossum Exp $'
__version__='$Revision: 1.10 $'[11:-2] __version__='$Revision: 1.11 $'[11:-2]
import os, sys, unittest import os, sys, unittest
...@@ -59,10 +59,8 @@ class SecurityTests (DTMLTests): ...@@ -59,10 +59,8 @@ class SecurityTests (DTMLTests):
self.failUnlessRaises(Unauthorized, html, myinst=myclass()) self.failUnlessRaises(Unauthorized, html, myinst=myclass())
def testSecurityInSyntax(self): def testSecurityInSyntax(self):
''' # Ensures syntax errors are thrown for an expr with restricted
Ensures syntax errors are thrown for an expr with restricted # syntax.
syntax.
'''
expr = '<dtml-var expr="(lambda x, _read=(lambda ob:ob): x.y)(c)">' expr = '<dtml-var expr="(lambda x, _read=(lambda ob:ob): x.y)(c)">'
try: try:
# This would be a security hole. # This would be a security hole.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment