Skip to content

Commit 16c657c

Browse files
committed
Added test_should_return_none_for_invalid_evaluation_id
1 parent a432e9d commit 16c657c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

data_hub_api/docmaps/v2/provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,5 @@ def iter_docmaps_index_json_stream(self):
8989
LOGGER.info('Finished streaming docmaps index as JSON.')
9090

9191
def get_evaluation_content_by_id(self, evaluation_id: str) -> Optional[str]:
92-
return 'dummy evaluation content for evaluation_id: ' + evaluation_id
92+
LOGGER.debug('Getting evaluation content for evaluation_id: %s', evaluation_id)
93+
return None

tests/unit_tests/docmaps/v2/provider_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ def test_should_cache_docmaps_query_results(
5555
assert docmaps_index['docmaps'] == [
5656
get_docmap_item_for_query_result_item(cast(ApiInput, DOCMAPS_QUERY_RESULT_ITEM_1))
5757
]
58+
59+
def test_should_return_none_for_invalid_evaluation_id(
60+
self,
61+
iter_dict_from_bq_query_mock: MagicMock
62+
):
63+
iter_dict_from_bq_query_mock.return_value = []
64+
docmaps_provider = DocmapsProvider()
65+
assert docmaps_provider.get_evaluation_content_by_id('not_found_id_1') is None

0 commit comments

Comments
 (0)