search.agent.tests.test_record_processor module

Unit tests for search.agent.

class search.agent.tests.test_record_processor.TestAddToIndex(methodName='runTest')[source]

Bases: unittest.case.TestCase

Add a search document to the index.

setUp()[source]

Initialize a MetadataRecordProcessor.

test_add_document_succeeds(mock_index, mock_client_factory)[source]

The search document is added successfully.

test_index_raises_index_connection_error(mock_index, mock_client_factory)[source]

The index raises index.IndexConnectionError.

test_index_raises_unhandled_error(mock_index, mock_client_factory)[source]

The index raises an unhandled exception.

class search.agent.tests.test_record_processor.TestBulkAddToIndex(methodName='runTest')[source]

Bases: unittest.case.TestCase

Add multiple search documents to the index in bulk.

setUp()[source]

Initialize a MetadataRecordProcessor.

test_bulk_add_documents_succeeds(mock_index, mock_client_factory)[source]

The search document is added successfully.

test_index_raises_index_connection_error(mock_index, mock_client_factory)[source]

The index raises index.IndexConnectionError.

test_index_raises_unhandled_error(mock_index, mock_client_factory)[source]

The index raises an unhandled exception.

class search.agent.tests.test_record_processor.TestGetMetadata(methodName='runTest')[source]

Bases: unittest.case.TestCase

Retrieve metadata for an arXiv e-print.

setUp()[source]

Initialize a MetadataRecordProcessor.

test_metadata_service_raises_bad_response(mock_metadata, mock_client_factory)[source]

The metadata service raises metadata.BadResponse.

test_metadata_service_raises_connection_error(mock_metadata, mock_client_factory)[source]

The metadata service raises metadata.ConnectionFailed.

test_metadata_service_raises_request_error(mock_metadata, mock_client_factory)[source]

The metadata service raises metadata.RequestFailed.

test_metadata_service_returns_metadata(mock_metadata, mock_client_factory)[source]

The metadata service returns valid metadata.

class search.agent.tests.test_record_processor.TestIndexPaper(methodName='runTest')[source]

Bases: unittest.case.TestCase

Re-index all versions of an arXiv paper.

setUp()[source]

Initialize a MetadataRecordProcessor.

test_paper_has_one_version(mock_meta, mock_tx, mock_idx, mock_client_factory)[source]

The arXiv paper has only one version.

test_paper_has_three_versions(mock_meta, mock_tx, mock_idx, mock_client_factory)[source]

The arXiv paper has three versions.

class search.agent.tests.test_record_processor.TestTransformToDocument(methodName='runTest')[source]

Bases: unittest.case.TestCase

Transform metadata into a search document.

setUp()[source]

Initialize a MetadataRecordProcessor.

test_transform_raises_exception(mock_transform, mock_client_factory)[source]

The transform module raises an exception.