[CMF-checkins] CVS: CMF/CMFTopic/tests - test_ListC.py:1.5.8.2

Tres Seaver tseaver@zope.com
Tue, 8 Jan 2002 07:35:30 -0500


Update of /cvs-repository/CMF/CMFTopic/tests
In directory cvs.zope.org:/tmp/cvs-serv17452/CMFTopic/tests

Modified Files:
      Tag: CMF-1_2-branch
	test_ListC.py 
Log Message:
 - Merge fix for tracker #442 from branch.

=== CMF/CMFTopic/tests/test_ListC.py 1.5.8.1 => 1.5.8.2 ===
 
         items = listc.getCriteriaItems()
-        self.assertEqual( items[0][1], tuple( abc ) )
+        self.failUnless( 'foofield' in map( lambda x: x[0], items ) )
+        self.failUnless( tuple( abc ) in map( lambda x: x[1], items ) )
+
+    def test_operator( self ):
+
+        from Products.CMFTopic.ListCriterion import ListCriterion
+        listc = ListCriterion( 'foo', 'foofield' )
+
+        abc = [ 'a', 'b', 'c' ]
+
+        listc.edit( abc )
+        items = listc.getCriteriaItems()
+        self.assertEqual( len( items ), 1 )
+
+        listc.edit( abc, 'or' )
+        items = listc.getCriteriaItems()
+        self.assertEqual( len( items ), 2 )
+        self.failUnless( ( 'foofield_operator', 'or' ) in items )
+
+        listc.edit( abc, 'and' )
+        items = listc.getCriteriaItems()
+        self.assertEqual( len( items ), 2 )
+        self.failUnless( ( 'foofield_operator', 'and' ) in items )
 
 def test_suite():
     return unittest.makeSuite( ListCriterionTests )