cybertools/link/tests.py
helmutm 24157bb323 add new 'link' package for general-purpose link and relation management
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3678 fd906abe-77d9-0310-91a1-e0d9ade77398
2010-01-13 14:00:27 +00:00

51 lines
1.1 KiB
Python
Executable file

# $Id$
import unittest
from zope.testing.doctestunit import DocFileSuite
from zope.interface.verify import verifyClass
from zope.interface import implements
from zope.app.intid.interfaces import IIntIds
class IntIdsStub(object):
"""A testing stub (mock utility) for IntIds."""
implements(IIntIds)
def __init__(self):
self.objs = []
def getObject(self, uid):
return self.objs[uid]
def register(self, ob):
if ob not in self.objs:
self.objs.append(ob)
return self.objs.index(ob)
getId = register
queryId = getId
def unregister(self, ob):
id = self.getId(ob)
self.objs[id] = None
def __iter__(self):
return iter(xrange(len(self.objs)))
class TestLink(unittest.TestCase):
"Basic tests for the link package."
def testBasics(self):
pass
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestLink),
DocFileSuite('README.txt'),
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')