Example #1
0
    def test_it_skips_indexing_when_annotation_cannot_be_loaded(
            self, fetch_annotation, index, celery):
        fetch_annotation.return_value = None

        indexer.add_annotation('test-annotation-id')

        assert index.called is False
Example #2
0
    def test_it_calls_index_with_annotation(self, fetch_annotation, index, celery):
        id_ = 'test-annotation-id'
        annotation = mock.Mock(id=id_)
        fetch_annotation.return_value = annotation

        indexer.add_annotation(id_)

        index.assert_called_once_with(celery.request.es, annotation, celery.request)
Example #3
0
    def test_it_calls_index_with_annotation(self, fetch_annotation, index,
                                            celery):
        id_ = 'test-annotation-id'
        annotation = mock.Mock(id=id_)
        fetch_annotation.return_value = annotation

        indexer.add_annotation(id_)

        index.assert_called_once_with(celery.request.es, annotation,
                                      celery.request)
Example #4
0
    def test_it_fetches_the_annotation(self, fetch_annotation, celery):
        id_ = 'test-annotation-id'

        indexer.add_annotation(id_)

        fetch_annotation.assert_called_once_with(celery.request.db, id_)
Example #5
0
    def test_it_fetches_the_annotation(self, fetch_annotation, celery):
        id_ = 'test-annotation-id'

        indexer.add_annotation(id_)

        fetch_annotation.assert_called_once_with(celery.request.db, id_)
Example #6
0
    def test_it_skips_indexing_when_annotation_cannot_be_loaded(self, fetch_annotation, index, celery):
        fetch_annotation.return_value = None

        indexer.add_annotation('test-annotation-id')

        assert index.called is False