[Zope-CVS] CVS: Products/CMFActionIcons/tests - test_ActionIconsTool.py:1.2

Tres Seaver tseaver at zope.com
Tue Apr 20 15:30:04 EDT 2004


Update of /cvs-repository/Products/CMFActionIcons/tests
In directory cvs.zope.org:/tmp/cvs-serv31608/tests

Modified Files:
	test_ActionIconsTool.py 
Log Message:


  - CMF Collector #239:  setting the icon expression to None no longer
    cripples the binding.


=== Products/CMFActionIcons/tests/test_ActionIconsTool.py 1.1.1.1 => 1.2 ===
--- Products/CMFActionIcons/tests/test_ActionIconsTool.py:1.1.1.1	Sun May 25 23:38:25 2003
+++ Products/CMFActionIcons/tests/test_ActionIconsTool.py	Tue Apr 20 15:30:02 2004
@@ -6,7 +6,7 @@
 
     def _makeOne( self, *args, **kw ):
 
-        from Products.NOTSite.ActionIconsTool import ActionIconsTool
+        from Products.CMFActionIcons.ActionIconsTool import ActionIconsTool
         
         return ActionIconsTool( *args, **kw )
 
@@ -75,6 +75,41 @@
         self.assertEqual( icon.getActionId(), 'def' )
         self.assertEqual( icon.getExpression(), 'ghi' )
         self.assertEqual( icon.getIconURL(), 'ghi' )
+
+    def test_updateActionIcon( self ):
+
+        tool = self._makeOne()
+
+        tool.addActionIcon( 'foo', 'bar', 'qux' )
+
+        self.assertEqual( tool.getActionIcon( 'foo', 'bar' ), 'qux' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar' ), 'qux' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar', 'baz' ), 'qux' )
+
+        tool.updateActionIcon( 'foo', 'bar', 'bam' )
+
+        self.assertEqual( tool.getActionIcon( 'foo', 'bar' ), 'bam' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar' ), 'bam' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar', 'baz' ), 'bam' )
+
+    def test_updateActionIcon_emptyiconexpr( self ):
+
+        # CMF Collector # 239
+
+        tool = self._makeOne()
+        tool.addActionIcon( 'foo', 'bar', 'qux' )
+        tool.updateActionIcon( 'foo', 'bar', '' )
+        tool.updateActionIcon( 'foo', 'bar', 'bam' )
+
+        self.assertEqual( tool.getActionIcon( 'foo', 'bar' ), 'bam' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar' ), 'bam' )
+        self.assertEqual( tool.queryActionIcon( 'foo', 'bar', 'baz' ), 'bam' )
+
+    def test_updateActionIcon_nonesuch( self ):
+
+        tool = self._makeOne()
+        self.assertRaises( KeyError
+                         , tool.updateActionIcon, 'foo', 'baz', 'qux' )
 
     def test_removeActionIcon( self ):
 




More information about the Zope-CVS mailing list