diff --git a/cyc-logo02.png b/cyc-logo02.png deleted file mode 100644 index eac2e09..0000000 Binary files a/cyc-logo02.png and /dev/null differ diff --git a/doc/menu.txt b/doc/menu.txt new file mode 100644 index 0000000..04c9548 --- /dev/null +++ b/doc/menu.txt @@ -0,0 +1,7 @@ +Creating and Rendering Menus +============================ + +We first set up a test environment: + + >>> from zope.app.testing import ztapi + diff --git a/interfaces.py b/interfaces.py new file mode 100644 index 0000000..f14f179 --- /dev/null +++ b/interfaces.py @@ -0,0 +1,34 @@ +# +# Copyright (c) 2005 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +cybertools interface definitions. + +$Id$ +""" + +from zope.interface import Interface +from zope.app.container.interfaces import IOrderedContainer + +from zope.schema import Text, TextLine, List, Object, Int + + +class IMenu(Interface): + """ A Menu. + """ + diff --git a/menu.py b/menu.py new file mode 100644 index 0000000..7a67c25 --- /dev/null +++ b/menu.py @@ -0,0 +1,35 @@ +# +# Copyright (c) 2005 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +Definition of the Menu class. + +$Id$ +""" + +from zope.interface import implements +from zope.app.container.ordered import OrderedContainer +from zope.app import zapi + +from interfaces import IMenu + +class Menu(OrderedContainer): + + implements(IMenu) + + title = u'' diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..4bc90fb --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +""" +$Id$ +""" + diff --git a/tests/test_cybertools.py b/tests/test_cybertools.py new file mode 100755 index 0000000..e3ef792 --- /dev/null +++ b/tests/test_cybertools.py @@ -0,0 +1,46 @@ +# $Id$ + +import unittest +from zope.testing.doctestunit import DocFileSuite +from zope.app.testing import ztapi +from zope.interface.verify import verifyClass +#from zope.app.tests.setup import placelessSetUp +from zope.app.testing.setup import placefulSetUp +from zope.app.container.interfaces import IContained +from zope.app.folder import Folder +from zope.app import zapi + +from cybertools.menu import Menu +from cybertools.interfaces import IMenu + +class TestMenu(unittest.TestCase): + "Test methods of the Menu class." + + def setUp(self): +# placelessSetUp() + placefulSetUp() + self.f1 = Folder() + self.f1.__name__ = u'f1' + self.m1 = Menu() + self.f1['m1'] = self.m1 + + def tearDown(self): + pass + + # the tests... + + def testInterface(self): + self.assert_(IMenu.providedBy(Menu()), + 'Interface IMenu is not implemented by class Menu.') + self.assert_(IContained.providedBy(Menu()), + 'Interface IContained is not implemented by class Menu.') + verifyClass(IMenu, Menu) + +def test_suite(): + return unittest.TestSuite(( + unittest.makeSuite(TestMenu), + DocFileSuite('../doc/menu.txt'), + )) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite')