[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/rotterdam/tests - util.py:1.1 __init__.py:1.1 test_xmlnavigationviews.py:1.1

Godefroid Chapelle gotcha@swing.be
Thu, 2 Jan 2003 06:06:13 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/skins/rotterdam/tests
In directory cvs.zope.org:/tmp/cvs-serv29656

Added Files:
	util.py __init__.py test_xmlnavigationviews.py 
Log Message:
first tests for XML navigation views


=== Added File Zope3/src/zope/app/browser/skins/rotterdam/tests/util.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.
#
##############################################################################
import os

import zope.app.browser.skins.rotterdam.tests

dir = os.path.dirname(zope.app.browser.skins.rotterdam.tests.__file__)
input_dir = os.path.join(dir, 'input')
output_dir = os.path.join(dir, 'output')

def read_input(filename):
    filename = os.path.join(input_dir, filename)
    return open(filename, 'r').read()

def read_output(filename):
    filename = os.path.join(output_dir, filename)
    return open(filename, 'r').read()


=== Added File Zope3/src/zope/app/browser/skins/rotterdam/tests/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/browser/skins/rotterdam/tests/test_xmlnavigationviews.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.
#
##############################################################################
"""

Revision information:
$Id: test_xmlnavigationviews.py,v 1.1 2003/01/02 11:06:10 gotcha Exp $
"""

#import sys
#sys.path.insert(0, r"c:\Zope3\src")


from unittest import TestCase, TestLoader, TextTestRunner
from zope.app.services.tests.eventsetup import EventSetup
from zope.pagetemplate.tests.util import check_xml
from zope.app.browser.skins.rotterdam.tests import util
from zope.app.browser.skins.rotterdam.xmlobject import ReadContainerXmlObjectView
from zope.publisher.browser import TestRequest

class TestXmlObject(EventSetup, TestCase):
    
    def setUp(self):
        EventSetup.setUp(self)

    def testXMLTreeViews(self):
        treeView = ReadContainerXmlObjectView(self.folder1, TestRequest()).singleBranchTree
        check_xml(treeView(), util.read_output('test1.xml'))

        treeView = ReadContainerXmlObjectView(self.folder1, TestRequest()).children
        check_xml(treeView(), util.read_output('test2.xml'))

        treeView = ReadContainerXmlObjectView(self.folder1_1_1, TestRequest()).children
        check_xml(treeView(), util.read_output('test3.xml'))
        
        treeView = ReadContainerXmlObjectView(self.rootFolder, TestRequest()).children
        check_xml(treeView(), util.read_output('test4.xml'))

def test_suite():
    loader = TestLoader()
    return loader.loadTestsFromTestCase(TestXmlObject)

if __name__=='__main__':
    TextTestRunner().run(test_suite())