def test_index_and_unindex(self):
        instance = self._create_test_data()
        search_index = search_api.Index(name='test_index')

        search.index_entity(instance, index='test_index')

        response = search_index.get_range()
        assert len(response.results) == 1

        search.unindex_entity(instance, index='test_index')

        response = search_index.get_range()
        assert len(response.results) == 0
Beispiel #2
0
    def test_index_and_unindex(self):
        instance = self._create_test_data()
        search_index = search_api.Index(name='test_index')

        search.index_entity(instance, index='test_index')

        response = search_index.get_range()
        assert len(response.results) == 1

        search.unindex_entity(instance, index='test_index')

        response = search_index.get_range()
        assert len(response.results) == 0
 def before_delete(self, key):
     search.unindex_entity(key, self._get_index())