Skip to content

Commit

Permalink
test: server mode asset subset download
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Dec 1, 2023
1 parent 7191e24 commit a5456c3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/units/test_stac_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ def test_search_stac_items_with_stac_providers(self, mock__request):

response = self.rest_utils.search_stac_items(
url="http://foo/search",
arguments={},
arguments={"collections": "S2_MSI_L2A"},
root="http://foo",
catalogs=["S2_MSI_L2A"],
catalogs=[],
provider="earth_search",
)

Expand All @@ -445,11 +445,18 @@ def test_search_stac_items_with_stac_providers(self, mock__request):
self.assertTrue(
"downloadLink", "thumbnail" in response["features"][0]["assets"].keys()
)
# check that assets from the provider response search are also in the response
# check that assets from the provider response search are reformatted in the response
product_id = self.earth_search_resp_search_json["features"][0]["properties"][
"sentinel:product_id"
]
for (k, v) in self.earth_search_resp_search_json["features"][0][
"assets"
].items():
self.assertIn((k, v), response["features"][0]["assets"].items())
self.assertIn(k, response["features"][0]["assets"].keys())
self.assertEqual(
response["features"][0]["assets"][k]["href"],
f"http://foo/collections/S2_MSI_L2A/items/{product_id}/download/{k}?provider=earth_search",
)
# preferred provider should not be changed
self.assertEqual("peps", self.rest_utils.eodag_api.get_preferred_provider()[0])

Expand Down

0 comments on commit a5456c3

Please sign in to comment.