[Zope3-checkins] CVS: zopeproducts/friendlyfolder/ftests - __init__.py:1.1 test_caseinsensitivefolder.py:1.1

Vincenzo Di Somma vincenzo@reflab.it
Mon, 23 Jun 2003 13:36:18 -0400


Update of /cvs-repository/zopeproducts/friendlyfolder/ftests
In directory cvs.zope.org:/tmp/cvs-serv17377/ftests

Added Files:
	__init__.py test_caseinsensitivefolder.py 
Log Message:
Initial import

=== Added File zopeproducts/friendlyfolder/ftests/__init__.py ===


=== Added File zopeproducts/friendlyfolder/ftests/test_caseinsensitivefolder.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.
#
##############################################################################
"""XXX short summary goes here.

XXX longer description goes here.

$Id: test_caseinsensitivefolder.py,v 1.1 2003/06/23 17:36:17 vds Exp $
"""

import unittest
from zope.testing.functional import BrowserTestCase
from zope.publisher.interfaces import NotFound

class TestCaseInsensitiveFolder(BrowserTestCase):

    def testAddCasInsensitiveFolder(self):
        # Step 1: add the case insensitive folder
        response = self.publish('/+/action.html',
                                basic='mgr:mgrpw',
                                form={'type_name': u'CaseInsensitiveFolder', 'id': u'cisf'})
        self.assertEqual(response.getStatus(), 302)
        self.assertEqual(response.getHeader('Location'),
                         'http://localhost/@@contents.html')
        # Step 2: add the file
        response = self.publish('/cisf/+/action.html',
                                basic='mgr:mgrpw',
                                form={'type_name': u'File', 'id': u'foo'})
        self.assertEqual(response.getStatus(), 302)
        self.assertEqual(response.getHeader('Location'),
                         'http://localhost/cisf/@@contents.html')
        # Step 3: check that the file is traversed
        response = self.publish('/cisf/foo')
        self.assertEqual(response.getStatus(), 200)
        response = self.publish('/cisf/foO')
        self.assertEqual(response.getStatus(), 200)
        self.assertRaises(NotFound, self.publish, '/cisf/bar')
                          



def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestCaseInsensitiveFolder))
    return suite


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