Skip to content

Commit d0a548e

Browse files
committed
Issue #738 todo notes about lack of urllib/pystac mocking
mark places were we currently workaround the lack of proper pystac/urllib mocking
1 parent 026881d commit d0a548e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/rest/test_connection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,12 +2891,11 @@ def test_load_stac_from_job_empty_result(self, con120, requests_mock):
28912891

28922892
@pytest.mark.parametrize("temporal_dim", ["t", "datezz"])
28932893
def test_load_stac_reduce_temporal(self, con120, tmp_path, temporal_dim):
2894-
# TODO: reusable utility to create/generate a STAC resource for testing
2895-
# (a file, but preferably a URL, but that requires urllib mocking)
28962894
stac_path = tmp_path / "stac.json"
28972895
stac_data = StacDummyBuilder.collection(
28982896
cube_dimensions={temporal_dim: {"type": "temporal", "extent": ["2024-01-01", "2024-04-04"]}}
28992897
)
2898+
# TODO #738 real request mocking of STAC resources compatible with pystac?
29002899
stac_path.write_text(json.dumps(stac_data))
29012900

29022901
cube = con120.load_stac(str(stac_path))
@@ -2952,6 +2951,7 @@ def test_load_stac_no_cube_extension_temporal_dimension(self, con120, tmp_path,
29522951
# No cube:dimensions, but at least "temporal" extent is set as indicator for having a temporal dimension
29532952
assert "cube:dimensions" not in stac_data
29542953
assert deep_get(stac_data, "extent", "temporal")
2954+
# TODO #738 real request mocking of STAC resources compatible with pystac?
29552955
stac_path.write_text(json.dumps(stac_data))
29562956

29572957
cube = con120.load_stac(str(stac_path))
@@ -2962,6 +2962,7 @@ def test_load_stac_band_filtering(self, con120, tmp_path):
29622962
stac_data = StacDummyBuilder.collection(
29632963
summaries={"eo:bands": [{"name": "B01"}, {"name": "B02"}, {"name": "B03"}]}
29642964
)
2965+
# TODO #738 real request mocking of STAC resources compatible with pystac?
29652966
stac_path.write_text(json.dumps(stac_data))
29662967

29672968
cube = con120.load_stac(str(stac_path))

tests/test_metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ def filter_bbox(self, bbox):
844844
)
845845
def test_metadata_from_stac_bands(tmp_path, test_stac, expected):
846846
path = tmp_path / "stac.json"
847+
# TODO #738 real request mocking of STAC resources compatible with pystac?
847848
path.write_text(json.dumps(test_stac))
848849
metadata = metadata_from_stac(str(path))
849850
assert metadata.band_names == expected
@@ -925,6 +926,7 @@ def test_metadata_from_stac_collection_bands_from_item_assets(test_data, tmp_pat
925926
)
926927
def test_metadata_from_stac_temporal_dimension(tmp_path, stac_dict, expected):
927928
path = tmp_path / "stac.json"
929+
# TODO #738 real request mocking of STAC resources compatible with pystac?
928930
path.write_text(json.dumps(stac_dict))
929931
metadata = metadata_from_stac(str(path))
930932
if expected:

0 commit comments

Comments
 (0)