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

Commit

Permalink
Override get_should_continue for science museum ingester (#868)
Browse files Browse the repository at this point in the history
Override get_should_continue for science museum ingester
  • Loading branch information
aqeelat authored Nov 12, 2022
1 parent 0633553 commit 1bee01c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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
12 changes: 12 additions & 0 deletions tests/dags/providers/provider_api_scripts/test_science_museum.py
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

0 comments on commit 1bee01c

Please sign in to comment.