[Zope3-checkins] CVS: Products3/demo/messageboard/step2/tests - __init__.py:1.1 test_message.py:1.1 test_messageboard.py:1.1
Stephan Richter
srichter@cbu.edu
Sat, 7 Jun 2003 07:24:52 -0400
Update of /cvs-repository/Products3/demo/messageboard/step2/tests
In directory cvs.zope.org:/tmp/cvs-serv11446/messageboard/step2/tests
Added Files:
__init__.py test_message.py test_messageboard.py
Log Message:
Initial checkin of the Zope 3 Cookbook example code. Currently only step1
is completed and step2 is merely a copy right now. This product will be
updated as I am developing the recipes.
Note: Please do not make modifications to the code, unless you are willing
to spend the time modifying the recipes as well. At some point I will
add a final step, which can become the playground for developers and
will not mirror any recipe.
=== Added File Products3/demo/messageboard/step2/tests/__init__.py ===
=== Added File Products3/demo/messageboard/step2/tests/test_message.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.
#
##############################################################################
"""Message Board Tests
$Id: test_message.py,v 1.1 2003/06/07 11:24:51 srichter Exp $
"""
import unittest
from zope.testing.doctestunit import DocTestSuite
from zope.app.container.tests.test_icontainer import \
BaseTestIContainer, DefaultTestData
from zopeproducts.messageboard.message import Message
from zopeproducts.messageboard.interfaces import IMessage
class Test(BaseTestIContainer, unittest.TestCase):
def makeTestObject(self):
return Message()
def makeTestData(self):
return DefaultTestData()
def test_interface(self):
self.assert_(IMessage.isImplementedBy(
self.makeTestObject()))
def test_title():
"""
>>> msg = Message()
>>> msg.title
u''
>>> msg.title = u'Message Title'
>>> msg.title
u'Message Title'
"""
def test_body():
"""
>>> msg = Message()
>>> msg.body
u''
>>> msg.body = u'Message Body'
>>> msg.body
u'Message Body'
"""
def test_suite():
return unittest.TestSuite((
DocTestSuite(),
unittest.makeSuite(Test),
))
if __name__ == '__main__':
unittest.main()
=== Added File Products3/demo/messageboard/step2/tests/test_messageboard.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.
#
##############################################################################
"""Message Board Tests
$Id: test_messageboard.py,v 1.1 2003/06/07 11:24:51 srichter Exp $
"""
import unittest
from zope.app.container.tests.test_icontainer import \
BaseTestIContainer, DefaultTestData
from zopeproducts.messageboard.messageboard import MessageBoard
from zopeproducts.messageboard.interfaces import IMessageBoard
class Test(BaseTestIContainer, unittest.TestCase):
def makeTestObject(self):
return MessageBoard()
def makeTestData(self):
return DefaultTestData()
def test_interface(self):
self.assert_(IMessageBoard.isImplementedBy(
self.makeTestObject()))
def test_description(self):
board = self.makeTestObject()
self.assertEqual(u'', board.description)
board.description = u'Message Board Description'
self.assertEqual('Message Board Description',
board.description)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(Test),
))
if __name__ == '__main__':
unittest.main()