Пример #1
0
 def test_update_index(self, mock_bulk, mock_models, mock_actions,
                       mock_client, mock_qs):
     """Test the update_index function."""
     mock_foo = mock.Mock()
     mock_foo.search_doc_type = mock.PropertyMock(return_value="bar")
     mock_foo.objects = mock.PropertyMock(return_value=mock.Mock())
     mock_models.return_value = [mock_foo]
     responses = update_index("foo")
     self.assertEqual(responses, [mock_bulk.return_value])
    def do_index_command(self, index, **options):
        """Rebuild search index."""
        if options['interactive']:
            logger.warn("This will permanently delete the index '%s'.", index)
            if not self._confirm_action():
                logger.warn(
                    "Aborting rebuild of index '%s' at user's request.", index)
                return

        delete = delete_index(index)
        create = create_index(index)
        update = update_index(index)

        return {'delete': delete, 'create': create, 'update': update}
 def do_index_command(self, index, **options):
     """Update search index."""
     return update_index(index)