Back to index

plone3  3.1.7
test_bugs.py
Go to the documentation of this file.
00001 #  ATContentTypes http://plone.org/products/atcontenttypes/
00002 #  Archetypes reimplementation of the CMF core types
00003 #  Copyright (c) 2003-2006 AT Content Types development team
00004 #
00005 #  This program is free software; you can redistribute it and/or modify
00006 #  it under the terms of the GNU General Public License as published by
00007 #  the Free Software Foundation; either version 2 of the License, or
00008 #  (at your option) any later version.
00009 #
00010 #  This program is distributed in the hope that it will be useful,
00011 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 #  GNU General Public License for more details.
00014 #
00015 #  You should have received a copy of the GNU General Public License
00016 #  along with this program; if not, write to the Free Software
00017 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 #
00019 """Test module for bug reports
00020 """
00021 
00022 __author__ = 'Christian Heimes <tiran@cheimes.de>'
00023 __docformat__ = 'restructuredtext'
00024 
00025 from Testing import ZopeTestCase # side effect import. leave it here.
00026 from Products.ATContentTypes.tests import atcttestcase
00027 from Products.validation.interfaces.IValidator import IValidationChain
00028 from Products.ATContentTypes.content.schemata import ATContentTypeSchema
00029 
00030 from Products.Archetypes.atapi import *
00031 
00032 tests = []
00033 
00034 class TestBugs(atcttestcase.ATCTSiteTestCase):
00035 
00036     def afterSetUp(self):
00037         atcttestcase.ATCTSiteTestCase.afterSetUp(self)
00038         self.wf = self.portal.portal_workflow
00039 
00040     def test_wfmapping(self):
00041         default = ('plone_workflow',)
00042         folder = ('folder_workflow',)
00043 
00044         mapping = {
00045             'Document' : default,
00046             'Event' : default,
00047             'Favorite' : default,
00048             'File' : (),
00049             'Folder' : folder,
00050             'Large Plone Folder' : folder,
00051             'Image' : (),
00052             'Link' : default,
00053             'News Item' : default,
00054             'Topic' : folder,
00055             }
00056 
00057         for pt, wf in mapping.items():
00058             pwf = self.wf.getChainFor(pt)
00059             self.failUnlessEqual(pwf, wf, (pt, pwf, wf))
00060 
00061     def test_striphtmlbug(self):
00062         # Test for Plone tracker #4944
00063         self.folder.invokeFactory('Document', 'document')
00064         d = getattr(self.folder, 'document')
00065         d.setTitle("HTML end tags start with </ and end with >")
00066         self.assertEqual(d.Title(), "HTML end tags start with </ and end with >")
00067 
00068     def test_validation_layer_from_id_field_from_base_schema_was_initialized(self):
00069         field = ATContentTypeSchema['id']
00070         self.failUnless(IValidationChain.isImplementedBy(field.validators))
00071 
00072 
00073 tests.append(TestBugs)
00074 
00075 import unittest
00076 def test_suite():
00077     suite = unittest.TestSuite()
00078     for test in tests:
00079         suite.addTest(unittest.makeSuite(test))
00080     return suite