Skip to content

Commit

Permalink
add a test that proves boolean index remains ok when a reindexation has
Browse files Browse the repository at this point in the history
inverted the index value
  • Loading branch information
tdesvenain authored and hannosch committed Oct 15, 2013
1 parent 3f9afd4 commit 7de6910
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Products/PluginIndexes/BooleanIndex/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,24 @@ def test_migration(self):
self.assertEqual(index._index_length.value, 19)
self.assertEqual(list(index._index), range(80, 99))

def test_reindexation_when_index_reversed(self):
index = self._makeOne()
obj1 = Dummy(1, False)
index._index_object(obj1.id, obj1, attr='truth')
obj2 = Dummy(2, False)
self.assertTrue(index._index_value)
index._index_object(obj2.id, obj2, attr='truth')
obj3 = Dummy(3, True)
index._index_object(obj3.id, obj3, attr='truth')
obj4 = Dummy(4, True)
index._index_object(obj4.id, obj4, attr='truth')
obj1.truth = True
index._index_object(obj1.id, obj1, attr='truth')
self.assertFalse(index._index_value)

res = index._apply_index({'truth': True})[0]
self.assertEqual(list(res), [1, 3, 4])


def test_suite():
from unittest import TestSuite, makeSuite
Expand Down

0 comments on commit 7de6910

Please sign in to comment.