Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Berenbaum committed Sep 13, 2024
1 parent 67416f3 commit 1f82d38
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/lib/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,18 @@ def test_resolve_function():

assert result == "resolved_file"
mock_file.resolve.assert_called_once()


def test_get_local_path(tmp_path, catalog):
file_name = "myfile"
data = b"some\x00data\x00is\x48\x65\x6c\x57\x6f\x72\x6c\x64\xff\xffheRe"

file_path = tmp_path / file_name
with open(file_path, "wb") as fd:
fd.write(data)

file = File(path=file_name, source=f"file://{tmp_path}")
file._set_stream(catalog)

assert file.get_local_path() is None
assert file.get_local_path(download=True) is not None

0 comments on commit 1f82d38

Please sign in to comment.