[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/rotterdam/ftests - __init__.py:1.1 test_navtree.py:1.1

Grant Diffey nevyn at artificial-stupidity.net
Sun Feb 8 00:45:29 EST 2004


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

Added Files:
	__init__.py test_navtree.py 
Log Message:
Added a functional test for the navigation tree and fixed the navigation 
tree wrt folders with "'s in their name


=== Added File Zope3/src/zope/app/browser/skins/rotterdam/ftests/__init__.py ===
# make this directory a package


=== Added File Zope3/src/zope/app/browser/skins/rotterdam/ftests/test_navtree.py ===
import unittest
from xml.dom import minidom
from zope.testing.functional import BrowserTestCase
class TestNavTree(BrowserTestCase):

    def testnavtree(self):
        # Add some folders
        response = self.publish("/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'First'})
        self.assertEqual(response.getStatus(), 302)
        response = self.publish("/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'S&econd'})
        self.assertEqual(response.getStatus(), 302)
        response = self.publish("/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'Third'})
        self.assertEqual(response.getStatus(), 302)
        response = self.publish("/First/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'Firsts"Folder'})
        self.assertEqual(response.getStatus(), 302)
        response = self.publish("/First/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'somesite'})
        self.assertEqual(response.getStatus(), 302)

	#add a site manager This will break when site adding is fixed
	# see above for examples to fix by filling out a form
	# when further action is required to make a site
        response = self.publish("/First/somesite/addServiceManager.html",
						basic='mgr:mgrpw')
        self.assertEqual(response.getStatus(), 302)
        # /First/FirstsFolder/@@singleBranchTree.xml 
        # contains those 4 elements above
        # /@@children.xml 
	# contains First Second and Third
	
        response = self.publish(
	              "/First/somesite/++etc++site/@@singleBranchTree.xml",
						basic='mgr:mgrpw')
        self.assertEqual(response.getStatus(), 200)

	tree = minidom.parseString(response.getBody())

        response = self.publish("/@@children.xml", basic='mgr:mgrpw')
        self.assertEqual(response.getStatus(), 200)

	tree = minidom.parseString(response.getBody())

        response = self.publish("/First/+/action.html", basic='mgr:mgrpw', 
                                form={'type_name':u'Folder', 
                                      'id':u'Firsts2ndFolder'})
        self.assertEqual(response.getStatus(), 302)


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

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





More information about the Zope3-Checkins mailing list