From 2bb048087510d1a43c3c50c50cf1324ea1cba59b Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Wed, 12 Jan 2005 20:37:44 +0000 Subject: [PATCH] Started fixing functional tests. --- ftests.py | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 ftests.py diff --git a/ftests.py b/ftests.py new file mode 100644 index 0000000..41d8914 --- /dev/null +++ b/ftests.py @@ -0,0 +1,81 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (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. +# +############################################################################## +"""$Id$ +""" +import unittest +from xml.dom import minidom +from zope.app.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'zope.app.content.Folder', + 'id':u'First'}) + self.assertEqual(response.getStatus(), 302) + response = self.publish("/+/action.html", basic='mgr:mgrpw', + form={'type_name':u'zope.app.content.Folder', + 'id':u'S&econd'}) + self.assertEqual(response.getStatus(), 302) + response = self.publish("/+/action.html", basic='mgr:mgrpw', + form={'type_name':u'zope.app.content.Folder', + 'id':u'Third'}) + self.assertEqual(response.getStatus(), 302) + response = self.publish("/First/+/action.html", basic='mgr:mgrpw', + form={'type_name':u'zope.app.content.Folder', + 'id':u'Firsts"Folder'}) + self.assertEqual(response.getStatus(), 302) + response = self.publish("/First/+/action.html", basic='mgr:mgrpw', + form={'type_name':u'zope.app.content.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/addSiteManager.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'zope.app.content.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') +