[Zope-Checkins] CVS: Products/AdaptableStorage/tests - testASStorage.py:1.6 testZope2FS.py:1.12
Shane Hathaway
shane@zope.com
Mon, 6 Jan 2003 18:18:26 -0500
Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv1755/tests
Modified Files:
testASStorage.py testZope2FS.py
Log Message:
- Added a user folder mapper for the filesystem. SQL version coming
soon. (SQL tests fail at the moment.)
- Added unwriteData() to FSConnection. I may remove it later, since it turned
out I didn't need it.
- Made configuration errors easier to read.
- Added null implementations of certain interfaces.
- Added a default for FixedClassifier.
=== Products/AdaptableStorage/tests/testASStorage.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.5 Mon Jan 6 09:55:11 2003
+++ Products/AdaptableStorage/tests/testASStorage.py Mon Jan 6 18:17:53 2003
@@ -122,14 +122,16 @@
self.assertEqual(ob1.items(), [('a', 'b')])
self.assertEqual(ob1.stowaway.items(), [('c', 'd')])
- # Verify a new object was stored and make a change only to
- # the unmanaged persistent object (the "stowaway").
+ # Verify a new object was stored
get_transaction().begin()
conn2 = self.db.open()
ob2 = conn2.loadStub(('test2',))
self.assertEqual(ob2.items(), [('a', 'b')])
self.assertEqual(ob2.stowaway.items(), [('c', 'd')])
- ob2.stowaway['c'] = 'e'
+
+ # Make a change only to the unmanaged persistent object
+ # (the "stowaway").
+ ob.stowaway['c'] = 'e'
get_transaction().commit()
# Verify the change was stored and make a change to the
=== Products/AdaptableStorage/tests/testZope2FS.py 1.11 => 1.12 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.11 Mon Jan 6 10:36:51 2003
+++ Products/AdaptableStorage/tests/testZope2FS.py Mon Jan 6 18:17:53 2003
@@ -21,11 +21,13 @@
import unittest
from tempfile import mktemp
+from Acquisition import aq_base
from ZODB import Persistent
from Persistence import PersistentMapping
from OFS.Folder import Folder
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import SimpleItem
+from AccessControl.User import User, UserFolder
from Products.AdaptableStorage.zodb.ASDB import ASDB
from Products.AdaptableStorage.zodb.ASStorage import ASStorage
@@ -271,6 +273,40 @@
finally:
conn.close()
+
+
+ def testStoreUserFolder(self):
+ conn = self.db.open()
+ try:
+ app = conn.root()['Application']
+ f = UserFolder()
+ f.id = 'acl_users'
+ app._setObject(f.id, f, set_owner=0)
+ f._doAddUser('ned', 'abcdefg', ('Serf', 'Knight', 'King'), ())
+ get_transaction().commit()
+
+ u = f.data['ned']
+ self.assertEqual(u._p_oid, 'unmanaged') # Be sure ZODB sees it
+ u.roles = ('Knight', 'King')
+ get_transaction().commit()
+
+ conn2 = self.db.open()
+ try:
+ app = conn2.root()['Application']
+ ff = app.acl_users
+ self.assert_(aq_base(app.__allow_groups__) is aq_base(ff))
+ self.assert_(len(ff.data) == 1)
+ user = ff.data['ned']
+ self.assertEqual(user.name, 'ned')
+ self.assert_(user.domains == (), repr(user.domains))
+ self.assertEqual(user.roles, ('Knight', 'King'))
+ self.assert_(user is not u)
+ finally:
+ conn2.close()
+
+ finally:
+ conn.close()
+