Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Override get_should_continue for science museum ingester #868

Merged
merged 1 commit into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def _get_license(image_data) -> None | tuple[str, str]:
return license_, version
return None

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


def main():
logger.info("Begin: Science Museum data ingestion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,15 @@ def test_handle_obj_data_none(object_data):
actual_images = sm.get_record_data(object_data)

assert actual_images is None


def test_get_should_continue():
response_json = {"links": {"next": ""}}

assert sm.get_should_continue(response_json) is True


def test_get_should_continue_last_page():
response_json = {"links": {"next": None}}

assert sm.get_should_continue(response_json) is False