Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StacApiIO's write_text_to_href #312

Merged
merged 2 commits into from
Sep 15, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed

- Fix variable name in quickstart example [#316](https://github.com/stac-utils/pystac-client/pull/316)
- `StacApiIO.write_text_to_href` [#312](https://github.com/stac-utils/pystac-client/pull/312)

## Removed

Expand Down
2 changes: 1 addition & 1 deletion pystac_client/stac_api_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def write_text_to_href(self, href: str, *args: Any, **kwargs: Any) -> None:
if bool(urlparse(href).scheme):
raise APIError("Transactions not supported")
else:
return super().write_text_to_href(*args, **kwargs)
return super().write_text_to_href(href, *args, **kwargs)

def stac_object_from_dict(
self,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_stac_api_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,11 @@ def test_custom_query_params(self, requests_mock: Mocker) -> None:
assert request_qp_name in actual_qp
assert len(actual_qp[request_qp_name]) == 1
assert actual_qp[request_qp_name][0] == request_qp_value

def test_write(self, tmp_path: Path) -> None:
stac_api_io = StacApiIO()
test_file = tmp_path / "test.txt"
stac_api_io.write_text_to_href(str(test_file), "Hi there!")
with open(test_file) as file:
data = file.read()
assert data == "Hi there!"