Esempio n. 1
0
 def test_Empty(self):
     sic = SimpleIntCriterion('foo', 'foofield')
     self.assertEqual(sic.getId(), 'foo')
     self.assertEqual(sic.field, 'foofield')
     self.assertEqual(sic.value, None)
     self.assertEqual(sic.getValueString(), '')
     self.assertEqual(len(sic.getCriteriaItems()), 0)
Esempio n. 2
0
 def test_Empty( self ):
     sic = SimpleIntCriterion( 'foo', 'foofield' )
     self.assertEqual( sic.getId(), 'foo' )
     self.assertEqual( sic.field, 'foofield' )
     self.assertEqual( sic.value, None )
     self.assertEqual( sic.getValueString(), '' )
     self.assertEqual( len(sic.getCriteriaItems() ), 0 )
Esempio n. 3
0
    def test_EditWithInt(self):
        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit(32)
        self.assertEqual(sic.value, 32)
        self.assertEqual(sic.getValueString(), '32')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 1)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(items[0][1], 32)
Esempio n. 4
0
    def test_Empty(self):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion('foo', 'foofield')
        self.assertEqual(sic.getId(), 'foo')
        self.assertEqual(sic.field, 'foofield')
        self.assertEqual(sic.value, None)
        self.assertEqual(sic.getValueString(), '')
        self.assertEqual(len(sic.getCriteriaItems()), 0)
Esempio n. 5
0
    def test_EditWithInt( self ):
        sic = SimpleIntCriterion( 'foo', 'foofield' )
        sic.edit( 32 )
        self.assertEqual( sic.value, 32 )
        self.assertEqual( sic.getValueString(), '32' )

        items = sic.getCriteriaItems()
        self.assertEqual( len(items), 1 )
        self.assertEqual( len(items[0]), 2 )
        self.assertEqual( items[0][1], 32 )
Esempio n. 6
0
    def test_Empty( self ):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion( 'foo', 'foofield' )
        self.assertEqual( sic.getId(), 'foo' )
        self.assertEqual( sic.field, 'foofield' )
        self.assertEqual( sic.value, None )
        self.assertEqual( sic.getValueString(), '' )
        self.assertEqual( len(sic.getCriteriaItems() ), 0 )
Esempio n. 7
0
    def test_RangeMax(self):
        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit('32', SimpleIntCriterion.MAXIMUM)

        self.assertEqual(sic.value, 32)
        self.assertEqual(sic.getValueString(), '32')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 1)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(items[0][0], 'foofield')
        self.assertEqual(items[0][1]['query'], 32)
        self.assertEqual(items[0][1]['range'], 'max')
Esempio n. 8
0
    def test_RangeMinMax_withTuple(self):
        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit((32, 34), SimpleIntCriterion.MINMAX)

        self.assertEqual(sic.value, (32, 34))
        self.assertEqual(sic.getValueString(), '32 34')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 1)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(items[0][0], 'foofield')
        self.assertEqual(items[0][1]['query'], (32, 34))
        self.assertEqual(items[0][1]['range'], 'min:max')
Esempio n. 9
0
    def test_RangeMax( self ):
        sic = SimpleIntCriterion( 'foo', 'foofield' )
        sic.edit( '32', SimpleIntCriterion.MAXIMUM )

        self.assertEqual( sic.value, 32 )
        self.assertEqual( sic.getValueString(), '32' )

        items = sic.getCriteriaItems()
        self.assertEqual( len(items), 1 )
        self.assertEqual( len( items[0] ), 2 )
        self.assertEqual( items[0][0], 'foofield' )
        self.assertEqual( items[0][1]['query'], 32 )
        self.assertEqual( items[0][1]['range'], 'max' )
Esempio n. 10
0
    def test_RangeMinMax_withTuple( self ):
        sic = SimpleIntCriterion( 'foo', 'foofield' )
        sic.edit( ( 32, 34 ), SimpleIntCriterion.MINMAX )

        self.assertEqual( sic.value, ( 32, 34 ) )
        self.assertEqual( sic.getValueString(), '32 34' )

        items = sic.getCriteriaItems()
        self.assertEqual( len(items), 1 )
        self.assertEqual( len( items[0] ), 2 )
        self.assertEqual( items[0][0], 'foofield' )
        self.assertEqual( items[0][1]['query'], ( 32, 34 ) )
        self.assertEqual( items[0][1]['range'], 'min:max' )
Esempio n. 11
0
    def test_EditWithString(self):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit('0')
        self.assertEqual(sic.value, 0)
        self.assertEqual(sic.getValueString(), '0')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 1)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(items[0][0], 'foofield')
        self.assertEqual(items[0][1], 0)
Esempio n. 12
0
    def test_EditWithString( self ):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit('0')
        self.assertEqual( sic.value, 0 )
        self.assertEqual( sic.getValueString(), '0' )

        items = sic.getCriteriaItems()
        self.assertEqual( len( items ), 1 )
        self.assertEqual( len( items[0] ), 2 )
        self.assertEqual( items[0][0], 'foofield' )
        self.assertEqual( items[0][1], 0 )
Esempio n. 13
0
    def test_RangeMin_withInt(self):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit(32, SimpleIntCriterion.MINIMUM)

        self.assertEqual(sic.value, 32)
        self.assertEqual(sic.getValueString(), '32')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 2)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(len(items[1]), 2)
        self.assertEqual(items[0][0], 'foofield')
        self.assertEqual(items[0][1], 32)
        self.assertEqual(items[1][0], 'foofield_usage')
        self.assertEqual(items[1][1], 'range:min')
Esempio n. 14
0
    def test_RangeMinMax_withTuple(self):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion('foo', 'foofield')
        sic.edit((32, 34), SimpleIntCriterion.MINMAX)

        self.assertEqual(sic.value, (32, 34))
        self.assertEqual(sic.getValueString(), '32 34')

        items = sic.getCriteriaItems()
        self.assertEqual(len(items), 2)
        self.assertEqual(len(items[0]), 2)
        self.assertEqual(len(items[1]), 2)
        self.assertEqual(items[0][0], 'foofield')
        self.assertEqual(items[0][1], (32, 34))
        self.assertEqual(items[1][0], 'foofield_usage')
        self.assertEqual(items[1][1], 'range:min:max')
Esempio n. 15
0
    def test_RangeMin_withInt( self ):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion( 'foo', 'foofield' )
        sic.edit( 32, SimpleIntCriterion.MINIMUM )

        self.assertEqual( sic.value, 32 )
        self.assertEqual( sic.getValueString(), '32' )

        items = sic.getCriteriaItems()
        self.assertEqual( len( items ), 2 )
        self.assertEqual( len( items[0] ), 2 )
        self.assertEqual( len( items[1] ), 2 )
        self.assertEqual( items[0][0], 'foofield' )
        self.assertEqual( items[0][1], 32 )
        self.assertEqual( items[1][0], 'foofield_usage' )
        self.assertEqual( items[1][1], 'range:min' )
Esempio n. 16
0
    def test_RangeMinMax_withTuple( self ):

        from Products.CMFTopic.SimpleIntCriterion import SimpleIntCriterion

        sic = SimpleIntCriterion( 'foo', 'foofield' )
        sic.edit( ( 32, 34 ), SimpleIntCriterion.MINMAX )

        self.assertEqual( sic.value, ( 32, 34 ) )
        self.assertEqual( sic.getValueString(), '32 34' )

        items = sic.getCriteriaItems()
        self.assertEqual( len( items ), 2 )
        self.assertEqual( len( items[0] ), 2 )
        self.assertEqual( len( items[1] ), 2 )
        self.assertEqual( items[0][0], 'foofield' )
        self.assertEqual( items[0][1], ( 32, 34 ) )
        self.assertEqual( items[1][0], 'foofield_usage' )
        self.assertEqual( items[1][1], 'range:min:max' )