Skip to content

Commit

Permalink
Update tests for level1 searching
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed Dec 20, 2023
1 parent 10b667b commit 8e52514
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/integration/test_wagl.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,23 @@


def test_get_level1_metadata_path_yaml_in_dir():
wagl_doc = {"source_datasets": {"source_level1": L1_C2_METADATA_DIR}}
doc = _load_level1_doc(wagl_doc)
doc = _load_level1_doc(L1_C2_METADATA_DIR)
assert doc.id == UUID("d9221c40-24c3-5356-ab22-4dcac2bf2d70")


def test_get_level1_metadata_path_yaml_alongside_tar():
wagl_doc = {"source_datasets": {"source_level1": L1_C2_METADATA_TAR}}
doc = _load_level1_doc(wagl_doc)
doc = _load_level1_doc(L1_C2_METADATA_TAR)
assert doc.id == UUID("f23c5fa2-3321-5be9-9872-2be73fee12a6")


def test_get_level1_metadata_no_source():
# Complain when the embedded level1 reference doesn't exist.
wagl_doc = {"source_datasets": {"source_level1": "/no/where/good"}}
with pytest.raises(
ValueError,
match="No level1 found or provided. WAGL said it was at path '/no/where/good'*",
):
_load_level1_doc(wagl_doc)
_load_level1_doc(Path("/no/where/good"))

# .... unless we allow missing provenance.
doc = _load_level1_doc(wagl_doc, allow_missing_provenance=True)
doc = _load_level1_doc(Path("/no/where/good"), allow_missing_provenance=True)
assert doc is None

0 comments on commit 8e52514

Please sign in to comment.