コード例 #1
0
ファイル: index_test.py プロジェクト: nlisgo/h
    def test_it_logs_NotFoundErrors(self, es, log):
        """NotFoundErrors from elasticsearch should be caught and logged."""
        es.conn.delete.side_effect = elasticsearch.NotFoundError()

        index.delete(es, mock.Mock())

        assert log.exception.called
コード例 #2
0
ファイル: index_test.py プロジェクト: zermelozf/h
    def test_it_logs_NotFoundErrors(self, es, log):
        """NotFoundErrors from elasticsearch should be caught and logged."""
        es.conn.delete.side_effect = elasticsearch.NotFoundError()

        index.delete(es, mock.Mock())

        assert log.exception.called
コード例 #3
0
ファイル: index_test.py プロジェクト: ssin122/test-h
    def test_it_marks_annotation_as_deleted(self, es):
        index.delete(es, 'test_annotation_id')

        es.conn.index.assert_called_once_with(index='hypothesis',
                                              doc_type='annotation',
                                              body={'deleted': True},
                                              id='test_annotation_id')
コード例 #4
0
def delete_annotation(id_):
    delete(celery.request.es, id_)

    # If a reindex is running at the moment, delete annotation from the
    # new index as well.
    future_index = _current_reindex_new_name(celery.request)
    if future_index is not None:
        delete(celery.request.es, id_, target_index=future_index)
コード例 #5
0
ファイル: index_test.py プロジェクト: nlisgo/h
    def test_it_deletes_the_annotation(self, es):
        index.delete(es, 'test_annotation_id')

        es.conn.delete.assert_called_once_with(
            index='hypothesis',
            doc_type='annotation',
            id='test_annotation_id',
        )
コード例 #6
0
ファイル: index_test.py プロジェクト: zermelozf/h
    def test_it_deletes_the_annotation(self, es):
        index.delete(es, 'test_annotation_id')

        es.conn.delete.assert_called_once_with(
            index='hypothesis',
            doc_type='annotation',
            id='test_annotation_id',
        )
コード例 #7
0
ファイル: indexer.py プロジェクト: ssin122/test-h
def delete_annotation(id_):
    delete(celery.request.es, id_)

    # If a reindex is running at the moment, delete annotation from the
    # new index as well.
    future_index = _current_reindex_new_name(celery.request)
    if future_index is not None:
        delete(celery.request.es, id_, target_index=future_index)
コード例 #8
0
    def test_it_marks_annotation_as_deleted(self, es):
        index.delete(es, 'test_annotation_id')

        es.conn.index.assert_called_once_with(
            index='hypothesis',
            doc_type='annotation',
            body={'deleted': True},
            id='test_annotation_id'
        )
コード例 #9
0
    def test_it_allows_to_override_target_index(self, es):
        index.delete(es, 'test_annotation_id', target_index='custom-index')

        _, kwargs = es.conn.index.call_args
        assert kwargs['index'] == 'custom-index'
コード例 #10
0
ファイル: index_test.py プロジェクト: ssin122/test-h
    def test_it_allows_to_override_target_index(self, es):
        index.delete(es, 'test_annotation_id', target_index='custom-index')

        _, kwargs = es.conn.index.call_args
        assert kwargs['index'] == 'custom-index'
コード例 #11
0
ファイル: indexer.py プロジェクト: zermelozf/h
def delete_annotation(id_):
    delete(celery.request.es, id_)
コード例 #12
0
ファイル: indexer.py プロジェクト: nlisgo/h
def delete_annotation(id_):
    delete(celery.request.es, id_)
コード例 #13
0
ファイル: index_test.py プロジェクト: pombredanne/h
    def test_it_deletes_the_annotation(self, es):
        index.delete(es, "test_annotation_id")

        es.conn.delete.assert_called_once_with(index="hypothesis", doc_type="annotation", id="test_annotation_id")