[Zope3-checkins] CVS: Zope3/src/zope/app/fssync/tests -
test_fspickle.py:1.1.2.1 test_committer.py:1.16.6.3
Fred L. Drake, Jr.
fred at zope.com
Fri Sep 12 12:30:56 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv18315/tests
Modified Files:
Tag: parentgeddon-branch
test_committer.py
Added Files:
Tag: parentgeddon-branch
test_fspickle.py
Log Message:
when serializing objects using XML pickles, handle parent references as
relative to the object being serialized, and other references to external
objects as absolute path references
=== Added File Zope3/src/zope/app/fssync/tests/test_fspickle.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Location support tests
$Id: test_fspickle.py,v 1.1.2.1 2003/09/12 16:30:55 fdrake Exp $
"""
import unittest
from zope.testing.doctestunit import DocTestSuite
def test_suite():
return DocTestSuite('zope.app.fssync.fspickle')
if __name__ == '__main__':
unittest.main()
=== Zope3/src/zope/app/fssync/tests/test_committer.py 1.16.6.2 => 1.16.6.3 ===
--- Zope3/src/zope/app/fssync/tests/test_committer.py:1.16.6.2 Mon Sep 8 18:36:53 2003
+++ Zope3/src/zope/app/fssync/tests/test_committer.py Fri Sep 12 12:30:55 2003
@@ -22,36 +22,36 @@
from zope.component.service import serviceManager
from zope.component.adapter import provideAdapter
-from zope.app.tests.placelesssetup import PlacelessSetup
from zope.exceptions import NotFoundError
+from zope.interface import implements
from zope.xmlpickle import loads, dumps
from zope.fssync import fsutil
from zope.fssync.tests.mockmetadata import MockMetadata
from zope.fssync.tests.tempfiles import TempFiles
+from zope.app.content.fssync import DirectoryAdapter
from zope.app.interfaces.container import IContainer
from zope.app.interfaces.file import IFileFactory, IDirectoryFactory
from zope.app.interfaces.fssync import IGlobalFSSyncService
-from zope.app.interfaces.traversing import ITraversable
+from zope.app.interfaces.traversing import IContainmentRoot
+from zope.app.interfaces.traversing import ITraversable, ITraverser
+from zope.app.location import Location
+from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.fssync import committer # The module
from zope.app.fssync.committer import Checker, Committer, SynchronizationError
from zope.app.fssync.fsregistry import provideSynchronizer, fsRegistry
from zope.app.fssync.classes import Default
-from zope.app.content.fssync import DirectoryAdapter
-
-from zope.interface import implements
-
class Sample(object):
pass
-class PretendContainer(object):
+class PretendContainer(Location):
- implements(IContainer, ITraversable)
+ implements(IContainer, ITraversable, ITraverser)
def __init__(self):
self.holding = {}
@@ -93,6 +93,10 @@
PCname = PretendContainer.__module__ + "." + PretendContainer.__name__
+class PretendRootContainer(PretendContainer):
+
+ implements(IContainmentRoot)
+
class DictAdapter(Default):
@@ -159,12 +163,6 @@
x = committer.read_file(tfn)
self.assertEqual(x, data)
- def test_load_file(self):
- data = {"foo": [42]}
- tfn = self.tempfile(dumps(data))
- x = committer.load_file(tfn)
- self.assertEqual(x, data)
-
def test_set_item_non_icontainer(self):
container = {}
committer.set_item(container, "foo", 42)
@@ -212,13 +210,13 @@
self.assertEqual(container["foo"].__class__, PretendContainer)
def test_create_object_default(self):
- container = {}
+ container = PretendRootContainer()
entry = {"flag": "added"}
data = ["hello", "world"]
tfn = os.path.join(self.tempdir(), "foo")
self.writefile(dumps(data), tfn, "wb")
committer.create_object(container, "foo", entry, tfn)
- self.assertEqual(container, {"foo": ["hello", "world"]})
+ self.assertEqual(container.items(), [("foo", ["hello", "world"])])
def test_create_object_ifilefactory(self):
provideAdapter(IContainer, IFileFactory, file_factory_maker)
More information about the Zope3-Checkins
mailing list