Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
CMFTopic.tests.test_ListC.ListCriterionTests Class Reference
Inheritance diagram for CMFTopic.tests.test_ListC.ListCriterionTests:
Inheritance graph
[legend]
Collaboration diagram for CMFTopic.tests.test_ListC.ListCriterionTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_Empty
def test_Edit_withString
def test_Edit_withList
def test_operator

Private Member Functions

def _getTargetClass

Detailed Description

Definition at line 24 of file test_ListC.py.


Member Function Documentation

Definition at line 26 of file test_ListC.py.

00026 
00027     def _getTargetClass(self):
00028         from Products.CMFTopic.ListCriterion import ListCriterion
00029 
00030         return ListCriterion

Definition at line 53 of file test_ListC.py.

00053 
00054     def test_Edit_withList( self ):
00055         listc = self._makeOne('foo', 'foofield')
00056 
00057         abc = [ 'a', 'b', 'c' ]
00058         listc.edit( abc )
00059 
00060         items = listc.getCriteriaItems()
00061         self.failUnless( 'foofield' in map( lambda x: x[0], items ) )
00062         self.failUnless( tuple( abc ) in map( lambda x: x[1], items ) )

Definition at line 39 of file test_ListC.py.

00039 
00040     def test_Edit_withString( self ):
00041         listc = self._makeOne('foo', 'foofield')
00042 
00043         listc.edit('bar\nbaz')
00044         self.assertEqual( listc.getId(), 'foo' )
00045         self.assertEqual( listc.field, 'foofield' )
00046         self.assertEqual( listc.value, ( 'bar', 'baz' ) )
00047 
00048         items = listc.getCriteriaItems()
00049         self.assertEqual( len( items ), 1 )
00050         self.assertEqual( len( items[0] ), 2 )
00051         self.assertEqual( items[0][0], 'foofield' )
00052         self.assertEqual( items[0][1], ( 'bar', 'baz' ) )

Definition at line 31 of file test_ListC.py.

00031 
00032     def test_Empty( self ):
00033         listc = self._makeOne('foo', 'foofield')
00034 
00035         self.assertEqual( listc.getId(), 'foo' )
00036         self.assertEqual( listc.field, 'foofield' )
00037         self.assertEqual( listc.value, ('',) )
00038         self.assertEqual( len(listc.getCriteriaItems()), 0 )

Definition at line 63 of file test_ListC.py.

00063 
00064     def test_operator( self ):
00065         listc = self._makeOne('foo', 'foofield')
00066 
00067         abc = [ 'a', 'b', 'c' ]
00068 
00069         listc.edit( abc )
00070         items = listc.getCriteriaItems()
00071         self.assertEqual( len( items ), 1 )
00072 
00073         listc.edit( abc, 'or' )
00074         items = listc.getCriteriaItems()
00075         self.assertEqual( len( items ), 2 )
00076         self.failUnless( ( 'foofield_operator', 'or' ) in items )
00077 
00078         listc.edit( abc, 'and' )
00079         items = listc.getCriteriaItems()
00080         self.assertEqual( len( items ), 2 )
00081         self.failUnless( ( 'foofield_operator', 'and' ) in items )
00082 


The documentation for this class was generated from the following file: