-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(backends): exception when deleting outside localbackend dir
- Loading branch information
1 parent
7d4a1d2
commit 41b6985
Showing
2 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pathlib | ||
import pytest | ||
|
||
from chord_drs.backends.local import LocalBackend | ||
|
||
|
||
def test_local_backend(local_volume): | ||
backend = LocalBackend({"SERVICE_DATA": str(local_volume)}) | ||
|
||
file_to_ingest = pathlib.Path(__file__).parent / "dummy_file.txt" | ||
|
||
backend.save(file_to_ingest, "dummy_file.txt") | ||
assert (local_volume / "dummy_file.txt").exists() | ||
|
||
backend.delete(local_volume / "dummy_file.txt") | ||
assert not (local_volume / "dummy_file.txt").exists() | ||
|
||
|
||
def test_local_backend_raises(local_volume): | ||
backend = LocalBackend({"SERVICE_DATA": str(local_volume)}) | ||
|
||
with pytest.raises(ValueError): | ||
# before we can even figure out file does not exist, this is not a local volume subpath: | ||
backend.delete("/tmp/does_not_exist.txt") |