[Zope3-checkins] CVS: Zope3/src/zope/products/zwiki/tests - __init__.py:1.1 test_index.py:1.1 test_traversable.py:1.1 test_traverser.py:1.1 test_wiki.py:1.1 test_wikimail.py:1.1 test_wikipage.py:1.1 test_wikipagefile.py:1.1 test_wikipagehierarchy.py:1.1 test_wikipagesearchtext.py:1.1

K.Narasimha Murthy nmurthy at zeomega.com
Tue Dec 16 05:05:57 EST 2003


Update of /cvs-repository/Zope3/src/zope/products/zwiki/tests
In directory cvs.zope.org:/tmp/cvs-serv10613/tests

Added Files:
	__init__.py test_index.py test_traversable.py 
	test_traverser.py test_wiki.py test_wikimail.py 
	test_wikipage.py test_wikipagefile.py 
	test_wikipagehierarchy.py test_wikipagesearchtext.py 
Log Message:
Moved zwiki product from zopeproducts to zope.products, fixed the bugs and fixed test cases.


=== Added File Zope3/src/zope/products/zwiki/tests/__init__.py ===


=== Added File Zope3/src/zope/products/zwiki/tests/test_index.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_index.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest
from zope.interface import implements
from zope.app.index.text.tests import test_index
from zope.app.interfaces.index.text import ISearchableText
from zope.app.interfaces.container import IContained
from zope.app.services.tests.placefulsetup import PlacefulSetup

from zope.products.zwiki.interfaces import IWikiPage
from zope.products.zwiki.index import WikiTextIndex


class FakeSearchableObject:
    implements(ISearchableText, IWikiPage, IContained)

    __parent__ = None
    __name__ = None

    def __init__(self):
        self.texts = [u"Bruce"]

    def getSearchableText(self):
        return self.texts


class IndexTest(test_index.Test):

    # Note: There could be some more testing, checking that only WikiPage
    #       objects get indexed, but we can do this later. Good enoug for
    #       now.

    def setUp(self):
        PlacefulSetup.setUp(self)
        self.buildFolders()
        self.index = WikiTextIndex()
        self.rootFolder['myIndex'] = self.index
        self.object = FakeSearchableObject()
        self.rootFolder['bruce'] = self.object


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(IndexTest),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_traversable.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.
#
##############################################################################
"""

$Id: test_traversable.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest, sys
from zope.exceptions import NotFoundError
from zope.testing.cleanup import CleanUp

from zope.products.zwiki.wiki import Wiki
from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.traversal import WikiPageTraversable

from zope.app.services.tests.placefulsetup import PlacefulSetup

class TestTraversable(PlacefulSetup, CleanUp, unittest.TestCase):

    def setUp(self):
        PlacefulSetup.setUp(self)

    def testAttr(self):
        # test container path traversal
        wiki = Wiki()
        page1 = WikiPage()
        page2 = WikiPage()
        wiki['FrontPage'] = page1
        wiki['FooBar'] = page2
        # get the items again so they'll be wrapped in ContainedProxy
        page1 = wiki['FrontPage']
        page2 = wiki['FooBar']

        T = WikiPageTraversable(page1)
        self.failUnless(T.traverse('FooBar', (), 'FooBar', []) is page2)

        self.assertRaises(NotFoundError , T.traverse,
                          'morebar', (), 'morebar', [])


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(TestTraversable),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_traverser.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.
#
##############################################################################
"""

$Id: test_traverser.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""

import unittest, sys
from zope.component.tests.request import Request
from zope.component import getService
from zope.app.services.servicenames import Presentation
from zope.interface import Interface
from zope.exceptions import NotFoundError
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.proxy import removeAllProxies

from zope.products.zwiki.interfaces import IWikiPage
from zope.products.zwiki.wiki import Wiki
from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.traversal import WikiPageTraverser

class I(Interface):
    pass

class Request(Request):
    def getEffectiveURL(self):
        return ''

class View:
    def __init__(self, comp, request):
        self._comp = comp

class TestTraverser(PlacelessSetup, unittest.TestCase):

    def testAttr(self):
        wiki = Wiki()
        page1 = WikiPage()
        page2 = WikiPage()
        wiki['FrontPage'] = page1
        wiki['FooBar'] = page2
        # get the items again so they'll be wrapped in ContainedProxy
        page1 = wiki['FrontPage']
        page2 = wiki['FooBar']
        request = Request(I, '')

        T = WikiPageTraverser(page1, request)
        self.failUnless(
            removeAllProxies(T.publishTraverse(request, 'FooBar')) is page2)

        self.assertRaises(NotFoundError, T.publishTraverse, request,'morebar')

    def testView(self):
        wiki = Wiki()
        page1 = WikiPage()
        page2 = WikiPage()
        wiki['FrontPage'] = page1
        wiki['FooBar'] = page2
        # get the items again so they'll be wrapped in ContainedProxy
        page1 = wiki['FrontPage']
        page2 = wiki['FooBar']
        request = Request(I, '')

        T = WikiPageTraverser(page1, request)
        getService(None, Presentation).provideView(IWikiPage, 'viewfoo', I, [View])

        self.failUnless(
            T.publishTraverse(request, 'viewfoo').__class__ is View )
        self.failUnless(
            removeAllProxies(T.publishTraverse(request, 'FooBar')) is page2)

        self.assertRaises(NotFoundError, T.publishTraverse, request, 'morebar')
        self.assertRaises(NotFoundError, T.publishTraverse, request,
                          '@@morebar')


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(TestTraverser),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wiki.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wiki.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.app.container.tests.test_icontainer import \
     BaseTestIContainer, DefaultTestData
from zope.products.zwiki.wiki import Wiki
from zope.products.zwiki.interfaces import IWiki


class Test(BaseTestIContainer, unittest.TestCase):

    def makeTestObject(self):
        return Wiki()

    def makeTestData(self):
        return DefaultTestData()

    def test_interface(self):
        self.assert_(IWiki.isImplementedBy(self.makeTestObject()))

    def getUnknownKey(self):
        return '10'

    def getBadKeyTypes(self):
        return ['foo'], ('bar',), 20, 12.8

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

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wikimail.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wikimail.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.interface import classImplements 
from zope.app.tests import ztapi
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.interfaces.annotation import IAnnotations, IAttributeAnnotatable
from zope.app.interfaces.event import ISubscriber
from zope.app.attributeannotations import AttributeAnnotations

from zope.products.zwiki.interfaces import IWikiPage, IWiki, IMailSubscriptions
from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.wikipage import MailSubscriptions, WikiMailer, mailer
from zope.products.zwiki.wiki import Wiki

SubscriberKey = 'http://www.zope.org/zwiki#1.0/MailSubscriptions/emails'


class MailSubscriptionTest(PlacelessSetup):

    def getTestObject(self):
        raise NotImplementedError

    def setUp(self):
        PlacelessSetup.setUp(self)
        # This needs to be done, since the IAttributeAnnotable interface
        # is usually set in the ZCML
        classImplements(WikiPage, IAttributeAnnotatable)
        classImplements(Wiki, IAttributeAnnotatable)
        ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                       AttributeAnnotations)
        self._sub = MailSubscriptions(self.getTestObject())

    def test_Interface(self):
        self.failUnless(IMailSubscriptions.isImplementedBy(self._sub))

    def test_getSubscriptions(self):
        self.assertEqual((), self._sub.getSubscriptions())
        self._sub.context.__annotations__[SubscriberKey] = ('foo at bar.com',)
        self.assertEqual(('foo at bar.com',), self._sub.getSubscriptions())

    def test_addSubscriptions(self):
        self._sub.addSubscriptions(('foo at bar.com',))
        self.assertEqual(('foo at bar.com',),
                         self._sub.context.__annotations__[SubscriberKey])
        self._sub.addSubscriptions(('blah at bar.com',))
        self.assertEqual(('foo at bar.com', 'blah at bar.com'),
                         self._sub.context.__annotations__[SubscriberKey])
        self._sub.addSubscriptions(('blah at bar.com',))
        self.assertEqual(('foo at bar.com', 'blah at bar.com'),
                         self._sub.context.__annotations__[SubscriberKey])
        self._sub.addSubscriptions(('blah at bar.com', 'doh at bar.com'))
        self.assertEqual(('foo at bar.com', 'blah at bar.com', 'doh at bar.com'),
                         self._sub.context.__annotations__[SubscriberKey])

    def test_removeSubscriptions(self):
        self._sub.context.__annotations__[SubscriberKey] = (
            'foo at bar.com', 'blah at bar.com', 'doh at bar.com')
        self._sub.removeSubscriptions(('foo at bar.com',))
        self.assertEqual(('blah at bar.com', 'doh at bar.com'),
                         self._sub.context.__annotations__[SubscriberKey])
        self._sub.removeSubscriptions(('foo at bar.com',))
        self.assertEqual(('blah at bar.com', 'doh at bar.com'),
                         self._sub.context.__annotations__[SubscriberKey])
        self._sub.removeSubscriptions(('blah at bar.com', 'doh at bar.com'))
        self.assertEqual((),
                         self._sub.context.__annotations__[SubscriberKey])
        

class WikiPageMailSubscriptionTest(MailSubscriptionTest, unittest.TestCase):

    def getTestObject(self):
        return WikiPage()

class WikiMailSubscriptionTest(MailSubscriptionTest, unittest.TestCase):

    def getTestObject(self):
        return Wiki()


class WikiMailerTest(PlacefulSetup, unittest.TestCase):

    # Note: There are several other methods in this class, but they require
    #       mail to be sent out. One way to still write tests for these would
    #       be to implement a dummy smtplib.SMTP class...not now though. ;)

    def setUp(self):
        PlacefulSetup.setUp(self)
        # This needs to be done, since the IAttributeAnnotable interface
        # is usually set in the ZCML
        classImplements(WikiPage, IAttributeAnnotatable)
        classImplements(Wiki, IAttributeAnnotatable)
        ztapi.provideAdapter(IWikiPage, IMailSubscriptions,
                       MailSubscriptions)
        ztapi.provideAdapter(IWiki, IMailSubscriptions,
                       MailSubscriptions)
        ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                       AttributeAnnotations)

    def test_Interface(self):
        self.failUnless(ISubscriber.isImplementedBy(mailer))

    def test_getAllSubscribers(self):
        wiki = Wiki()
        wiki_sub = MailSubscriptions(wiki)
        wiki_sub.context.__annotations__[SubscriberKey] = ('foo at bar.com',)
        page = WikiPage()
        page_sub = MailSubscriptions(page)
        page_sub.context.__annotations__[SubscriberKey] = ('blah at bar.com',)
        wiki['page1'] = page
        # get the item again so it'll be wrapped in ContainedProxy
        page = wiki['page1']
        self.assertEqual(('blah at bar.com', 'foo at bar.com'),
                         mailer.getAllSubscribers(page))

def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(WikiMailSubscriptionTest),
        unittest.makeSuite(WikiPageMailSubscriptionTest),
        unittest.makeSuite(WikiMailerTest),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wikipage.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wikipage.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.interfaces import IWikiPage


class Test(unittest.TestCase):

    def makeTestObject(self):
        return WikiPage()

    def test_Interface(self):
        page = self.makeTestObject()
        self.failUnless(IWikiPage.isImplementedBy(page))

    def test_source(self):
        page = self.makeTestObject()
        self.assertEqual('', page.source)
        page.source = 'foo'
        self.assertEqual('foo', page.source)

    def test_type(self):
        page = self.makeTestObject()
        self.assertEqual('reStructured Text (reST)', page.type)
        page.type = 'foo'
        self.assertEqual('foo', page.type)

    def test_append(self):
        page = self.makeTestObject()
        page.source = 'the source'
        page.append(', more source')
        self.assertEqual('the source, more source', page.source)

    def test_comment(self):
        page = self.makeTestObject()
        page.source = 'the source'
        self.assertEqual(1, page.__dict__['_WikiPage__comments'])
        page.comment('\n\nthis is a comment')
        self.assertEqual("the source\n\nthis is a comment", page.source)
        self.assertEqual(2, page.__dict__['_WikiPage__comments'])

    def test_getCommentCounter(self):
        page = self.makeTestObject()
        self.assertEqual(1, page.getCommentCounter())
        page.comment('comment')
        self.assertEqual(2, page.getCommentCounter())
        
        
def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(Test),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wikipagefile.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wikipagefile.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.wikipage import WikiPageReadFile, WikiPageWriteFile


class ReadFileTest(unittest.TestCase):

    def setUp(self):
        self._page = WikiPage()
        self._page.source = u'This is the source'
        self._file = WikiPageReadFile(self._page)

    def test_read(self): 
        self.assertEqual(self._page.source, self._file.read())

    def test_size(self): 
        self.assertEqual(len(self._page.source), self._file.size())


class WriteFileTest(unittest.TestCase):

    def setUp(self):
        self._page = WikiPage()
        self._file = WikiPageWriteFile(self._page)

    def test_read(self): 
        self._file.write(u'This is the source')
        self.assertEqual(u'This is the source', self._page.source)


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(ReadFileTest),
        unittest.makeSuite(WriteFileTest),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wikipagehierarchy.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wikipagehierarchy.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.products.zwiki.interfaces import IWikiPage, IWikiPageHierarchy
from zope.products.zwiki.wikipage import WikiPage, WikiPageHierarchyAdapter
from zope.products.zwiki.wiki import Wiki
from zope.interface import implements, classImplements
from zope.app.tests import ztapi

from zope.app.interfaces.annotation import IAnnotations, IAttributeAnnotatable
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.interfaces.location import ILocation

from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.attributeannotations import AttributeAnnotations
from zope.app.location import LocationPhysicallyLocatable


class TestAnnotations(dict):
    implements(IAnnotations)


class Test(PlacefulSetup, unittest.TestCase):

    def setUp(self):
        PlacefulSetup.setUp(self)
        # This needs to be done, since the IAttributeAnnotable interface
        # is usually set in the ZCML
        classImplements(WikiPage, IAttributeAnnotatable);
        ztapi.provideAdapter(IAttributeAnnotatable, IAnnotations,
                       AttributeAnnotations)
        ztapi.provideAdapter(IWikiPage, IWikiPageHierarchy,
                       WikiPageHierarchyAdapter)
        ztapi.provideAdapter(ILocation, IPhysicallyLocatable, LocationPhysicallyLocatable)
        self.page = WikiPage()

    def makeTestObject(self):
        return WikiPageHierarchyAdapter(self.page)

    def test_Interface(self):
        hier = self.makeTestObject()
        self.failUnless(IWikiPageHierarchy.isImplementedBy(hier))

    def test_parents(self):
        hier = self.makeTestObject()
        self.assertEqual((), hier.parents)
        hier.parents = ('foo',)
        self.assertEqual(('foo',), hier.parents)
        # Test whether the annotations stay.
        hier = self.makeTestObject()
        self.assertEqual(('foo',), hier.parents)

    def test_reparent(self):
        hier = self.makeTestObject()
        hier.parents = ('foo',)
        self.assertEqual(('foo',), hier.parents)
        hier.reparent(('bar',))
        self.assertEqual(('bar',), hier.parents)

    def test_wikipath(self):
        wiki = Wiki()
        wiki['TopLevelPage'] = WikiPage()
        wiki['SecondLevelPage'] = WikiPage()
        hier = WikiPageHierarchyAdapter(wiki['SecondLevelPage'])
        hier.reparent(('TopLevelPage',))
        self.assertEqual([wiki['TopLevelPage'], wiki['SecondLevelPage']],
                         hier.path())

    def test_findChildren(self):
        wiki = Wiki()

        page1 = WikiPage()
        wiki['TopLevelPage'] = page1
        # get the item again so it'll be wrapped in ContainedProxy
        page1 = wiki['TopLevelPage']
        hier1 = WikiPageHierarchyAdapter(page1)

        page2 = WikiPage()
        wiki['SecondLevelPage'] = page2
        # get the item again so it'll be wrapped in ContainedProxy
        page2 = wiki['SecondLevelPage']
        hier2 = WikiPageHierarchyAdapter(page2)
        hier2.reparent(('TopLevelPage',))

        page3 = WikiPage()
        wiki['ThirdLevelPage'] = page3
        # get the item again so it'll be wrapped in ContainedProxy
        page3 = wiki['ThirdLevelPage']
        hier3 = WikiPageHierarchyAdapter(page3)
        hier3.reparent(('SecondLevelPage',))

        self.assertEqual(( (page2, ()), ),
                         hier1.findChildren(False));

        self.assertEqual(((page2, ((page3, ()),) ),),
                         hier1.findChildren());
        
    
def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(Test),
        ))

if __name__ == '__main__':
    unittest.main()


=== Added File Zope3/src/zope/products/zwiki/tests/test_wikipagesearchtext.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.
#
##############################################################################
"""ZWiki Tests

$Id: test_wikipagesearchtext.py,v 1.1 2003/12/16 10:05:56 nmurthy Exp $
"""
import unittest

from zope.products.zwiki.wikipage import WikiPage
from zope.products.zwiki.wikipage import SearchableText


class SearchableTextTest(unittest.TestCase):

    def setUp(self):
        self._page = WikiPage()
        self._page.source = u'This is the source'
        self._text = SearchableText(self._page)

    def test_getSearchableText(self): 
        self.assertEqual([self._page.source], self._text.getSearchableText())


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(SearchableTextTest),
        ))

if __name__ == '__main__':
    unittest.main()




More information about the Zope3-Checkins mailing list