[Zope-Checkins] CVS: Zope/lib/python/AccessControl/tests - testUserFolder.py:1.5.4.1
Chris McDonough
chrism@zope.com
Sat, 26 Oct 2002 15:52:07 -0400
Update of /cvs-repository/Zope/lib/python/AccessControl/tests
In directory cvs.zope.org:/tmp/cvs-serv31373/lib/python/AccessControl/tests
Modified Files:
Tag: chrism-install-branch
testUserFolder.py
Log Message:
Merge with HEAD. Again, sorry for the spew (what's left of it... someone seems to have filtered some of this branch's checkins out).
=== Zope/lib/python/AccessControl/tests/testUserFolder.py 1.5 => 1.5.4.1 ===
--- Zope/lib/python/AccessControl/tests/testUserFolder.py:1.5 Wed Aug 14 17:28:08 2002
+++ Zope/lib/python/AccessControl/tests/testUserFolder.py Sat Oct 26 15:51:37 2002
@@ -19,14 +19,11 @@
import os, sys, unittest
import ZODB
-from DocumentTemplate import HTML
-from DocumentTemplate.tests.testDTML import DTMLTests
-from Products.PythonScripts.standard import DTML
from AccessControl import User, Unauthorized
-from AccessControl.User import BasicUserFolder
+from AccessControl.User import BasicUserFolder, UserFolder, User
from ExtensionClass import Base
-class SecurityTests (DTMLTests):
+class UserFolderTests(unittest.TestCase):
def testMaxListUsers(self):
# create a folder-ish thing which contains a roleManager,
@@ -67,10 +64,38 @@
except OverflowError:
assert 0, "Raised overflow error erroneously"
+class UserTests(unittest.TestCase):
+
+ def testGetUserName(self):
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f.getUserName(), 'chris')
+
+ def testGetUserId(self):
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f.getId(), 'chris')
+
+ def testBaseUserGetIdEqualGetName(self):
+ # this is true for the default user type, but will not
+ # always be true for extended user types going forward (post-2.6)
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f.getId(), f.getUserName())
+
+ def testGetPassword(self):
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f._getPassword(), '123')
+
+ def testGetRoles(self):
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f.getRoles(), ('Manager', 'Authenticated'))
+
+ def testGetDomains(self):
+ f = User('chris', '123', ['Manager'], [])
+ self.assertEqual(f.getDomains(), ())
def test_suite():
suite = unittest.TestSuite()
- suite.addTest( unittest.makeSuite( SecurityTests ) )
+ suite.addTest(unittest.makeSuite(UserFolderTests))
+ suite.addTest(unittest.makeSuite(UserTests))
return suite
def main():