[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/FSSync/test - __init__.py:1.1.2.1 testGlobalFSSyncService.py:1.1.2.1

Jim Fulton jim@zope.com
Thu, 10 Oct 2002 09:14:23 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/FSSync/test
In directory cvs.zope.org:/tmp/cvs-serv20112/test

Added Files:
      Tag: FileSystemSync-branch
	__init__.py testGlobalFSSyncService.py 
Log Message:
Checked in some tentative synchronization registries and tests.



=== Added File Zope3/lib/python/Zope/App/FSSync/test/__init__.py ===
##############################################################################
#
# Copyright (c) 2002 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.
# 
##############################################################################


=== Added File Zope3/lib/python/Zope/App/FSSync/test/testGlobalFSSyncService.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 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.
#
##############################################################################
"""Test Glolal File-system synchronization services

$Id: testGlobalFSSyncService.py,v 1.1.2.1 2002/10/10 13:14:22 jim Exp $
"""

from unittest import TestCase, TestSuite, main, makeSuite

from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
from Zope.App.FSSync.GlobalFSSyncService import GlobalFSSyncService
from Zope.App.FSSync.IGlobalFSSyncService import IGlobalFSSyncService
from Zope.App.FSSync.IObjectFile import IObjectFile
from Interface.Verify import verifyObject

class C: "C Doc"
class C2: "C2 Doc"

class CAdapter:

    __implements__ = IObjectFile

    def __init__(self, object):
        self.context = object

    def extra(self):
        pass

    def typeIdentifier(self):
        return "spam"

    def factory(self):
        return "spam"

    def getBody(self):
        return self.context.__doc__

    def setBody(self):
        pass

class Test(Cleanup, TestCase):

    def testInterfaceVerification(self):
        service = GlobalFSSyncService()
        verifyObject(IGlobalFSSyncService, GlobalFSSyncService)

    def testRegistration(self):
        service = GlobalFSSyncService()
        adapter = service.querySynchronizer(C())
        self.assertEqual(adapter, None)
        service.provideSynchronizer(C, CAdapter)
        adapter = service.querySynchronizer(C2())
        self.assertEqual(adapter, None)
        adapter = service.querySynchronizer(C())
        self.assertEqual(adapter.__class__, CAdapter)
        self.assertEqual(adapter.getBody(), C.__doc__)
        
        
        
        
        

def test_suite():
    return TestSuite((
        makeSuite(Test),
        ))

if __name__=='__main__':
    main(defaultTest='test_suite')