Skip to content

Commit 0683ab9

Browse files
aqeelatMeet Parekh
authored and
Meet Parekh
committed
Override get_should_continue for science museum ingester (WordPress#868)
Override get_should_continue for science museum ingester
1 parent 2591746 commit 0683ab9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

openverse_catalog/dags/providers/provider_api_scripts/science_museum.py

+3
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ def _get_license(image_data) -> None | tuple[str, str]:
223223
return license_, version
224224
return None
225225

226+
def get_should_continue(self, response_json) -> bool:
227+
return response_json.get("links", {}).get("next") is not None
228+
226229

227230
def main():
228231
logger.info("Begin: Science Museum data ingestion")

tests/dags/providers/provider_api_scripts/test_science_museum.py

+12
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,15 @@ def test_handle_obj_data_none(object_data):
327327
actual_images = sm.get_record_data(object_data)
328328

329329
assert actual_images is None
330+
331+
332+
def test_get_should_continue():
333+
response_json = {"links": {"next": ""}}
334+
335+
assert sm.get_should_continue(response_json) is True
336+
337+
338+
def test_get_should_continue_last_page():
339+
response_json = {"links": {"next": None}}
340+
341+
assert sm.get_should_continue(response_json) is False

0 commit comments

Comments
 (0)