[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_xmldocument.py:1.1

Philipp von Weitershausen philikon@philikon.de
Wed, 9 Apr 2003 07:47:53 -0400


Update of /cvs-repository/Zope3/src/zope/app/content/tests
In directory cvs.zope.org:/tmp/cvs-serv20312/content/tests

Added Files:
	test_xmldocument.py 
Log Message:
Added XML document content object. It uses the new XML field.


=== Added File Zope3/src/zope/app/content/tests/test_xmldocument.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.
#
##############################################################################
"""
Basic tests for Page Templates used in content-space.

$Id: test_xmldocument.py,v 1.1 2003/04/09 11:47:52 philikon Exp $
"""

import unittest
from zope.schema.interfaces import ValidationError
from zope.app.content.xmldocument import XMLDocument

class XMLDocumentTests(unittest.TestCase):

    def test_create(self):
        doc = XMLDocument()
        doc = XMLDocument('<mydoc/>')
        self.assertRaises(ValidationError, XMLDocument, 'foo')

    def test_set(self):
        src = '<mydoc/>'
        doc = XMLDocument(src)
        self.assertEqual(src, doc.source)
        new_src = '<newdoc/>'
        doc.source = new_src
        self.assertEqual(new_src, doc.source)

def test_suite():
    return unittest.makeSuite(XMLDocumentTests)