コード例 #1
0
ファイル: index_test.py プロジェクト: welhefna/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')
コード例 #2
0
ファイル: indexer.py プロジェクト: hypothesis/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, "reindex.new_index")
    if future_index is not None:
        delete(celery.request.es, id_, target_index=future_index)
コード例 #3
0
ファイル: indexer.py プロジェクト: rolmovel/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)
コード例 #4
0
ファイル: index_test.py プロジェクト: gnott/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'
        )
コード例 #5
0
    def test_excludes_deleted_annotations(self, search, es_client, Annotation):
        deleted_ids = [Annotation(deleted=True).id]
        not_deleted_ids = [Annotation(deleted=False).id]

        # Deleted annotations need to be marked in the index using `h.search.index.delete`.
        for id_ in deleted_ids:
            index.delete(es_client, id_, refresh=True)

        result = search.run(webob.multidict.MultiDict({}))

        assert sorted(result.annotation_ids) == sorted(not_deleted_ids)
コード例 #6
0
ファイル: query_test.py プロジェクト: hypothesis/h
    def test_excludes_deleted_annotations(self, search, es_client, Annotation):
        deleted_ids = [Annotation(deleted=True).id]
        not_deleted_ids = [Annotation(deleted=False).id]

        # Deleted annotations need to be marked in the index using `h.search.index.delete`.
        for id_ in deleted_ids:
            index.delete(es_client, id_, refresh=True)

        result = search.run(webob.multidict.MultiDict({}))

        assert sorted(result.annotation_ids) == sorted(not_deleted_ids)
コード例 #7
0
ファイル: indexer.py プロジェクト: yumatch/h
def delete_annotation(id_):
    delete(celery.request.es, id_)

    if celery.request.feature('index_es6'):
        delete(celery.request.es6, 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,
                                             'reindex.new_index')
    if future_index is not None:
        delete(celery.request.es, id_, target_index=future_index)

    future_es6_index = _current_reindex_new_name(celery.request,
                                                 'reindex.new_es6_index')
    if future_es6_index is not None:
        delete(celery.request.es6, id_, target_index=future_es6_index)
コード例 #8
0
ファイル: index_test.py プロジェクト: welhefna/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'
コード例 #9
0
ファイル: old_index_test.py プロジェクト: chinmaygghag/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'