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
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)
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_)
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