[CMF-checkins] CVS: Products/CMFCore/tests - test_PortalFolder.py:1.33

Stefan H. Holek stefan at epy.co.at
Sat Jul 31 07:53:12 EDT 2004


Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv22286/CMFCore/tests

Modified Files:
	test_PortalFolder.py 
Log Message:
Fixed missing import of BadRequest exception.


=== Products/CMFCore/tests/test_PortalFolder.py 1.32 => 1.33 ===
--- Products/CMFCore/tests/test_PortalFolder.py:1.32	Mon Apr 26 08:14:17 2004
+++ Products/CMFCore/tests/test_PortalFolder.py	Sat Jul 31 07:53:07 2004
@@ -19,6 +19,7 @@
 from Products.CMFCore.tests.base.utils import has_path
 from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI
 from Products.CMFCore.TypesTool import TypesTool
+from Products.CMFCore.exceptions import BadRequest
 
 
 def extra_meta_types():
@@ -367,6 +368,31 @@
         assert not has_path( catalog._catalog, '/test/sub1/dummy' )
         assert has_path( catalog._catalog, '/test/sub2/dummy' )
         assert has_path( catalog._catalog, '/test/sub3/dummy' )
+
+    def test_setObjectRaisesBadRequest(self):
+        #
+        #   _setObject() should raise BadRequest on duplicate id
+        #
+        test = self.root.test
+        test._setObject('foo', DummyContent('foo'))
+        self.assertRaises(BadRequest, test._setObject, 'foo', 
+                                      DummyContent('foo'))
+
+    def test_checkIdRaisesBadRequest(self):
+        #
+        #   _checkId() should raise BadRequest on duplicate id
+        #
+        test = self.root.test
+        test._setObject('foo', DummyContent('foo'))
+        self.assertRaises(BadRequest, test._checkId, 'foo')
+
+    def test_checkIdAvailableCatchesBadRequest(self):
+        #
+        #   checkIdAvailable() should catch BadRequest
+        #
+        test = self.root.test
+        test._setObject('foo', DummyContent('foo'))
+        self.failIf(test.checkIdAvailable('foo'))
 
 
 class ContentFilterTests( TestCase ):



More information about the CMF-checkins mailing list