Skip to content

Commit

Permalink
Add is_broken call
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Jul 14, 2022
1 parent 673834d commit 6989433
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/hdx/data/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,14 @@ def disable_dataset_preview(self) -> None:
"""
self.data["dataset_preview_enabled"] = "False"

def is_broken(self) -> bool:
"""Return if resource is broken
Returns:
bool: Whether resource is broken
"""
return self.data.get("broken_link", False)

def mark_broken(self) -> None:
"""Mark resource as broken
Expand Down
2 changes: 1 addition & 1 deletion tests/hdx/data/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,4 +1004,4 @@ def test_mark_broken(self, configuration, post_broken):
assert resource["name"] == "MyResource1"
assert resource["package_id"] == "6f36a41c-f126-4b18-aaaf-6c2ddfbc5d4d"
resource.mark_broken()
assert resource["broken_link"] is True
assert resource.is_broken() is True

0 comments on commit 6989433

Please sign in to comment.