Skip to content

Commit

Permalink
test: orderLink in build_search plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Apr 3, 2024
1 parent d4d06ec commit 6ad35aa
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/units/test_search_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,8 @@ class TestSearchPluginBuildPostSearchResult(BaseSearchPluginTest):
@mock.patch("eodag.plugins.authentication.qsauth.requests.get", autospec=True)
def setUp(self, mock_requests_get):
super(TestSearchPluginBuildPostSearchResult, self).setUp()
# enable long diffs in test reports
self.maxDiff = None
# One of the providers that has a BuildPostSearchResult Search plugin
provider = "meteoblue"
self.search_plugin = self.get_search_plugin(provider=provider)
Expand All @@ -1385,8 +1387,10 @@ def test_plugins_search_buildpostsearchresult_count_and_search(
):
"""A query with a BuildPostSearchResult must return a single result"""

# custom query for meteoblue
custom_query = {"queries": {"foo": "bar"}}
products, estimate = self.search_plugin.query(
auth=self.auth_plugin,
auth=self.auth_plugin, **custom_query
)

mock_requests_post.assert_called_with(
Expand All @@ -1399,6 +1403,26 @@ def test_plugins_search_buildpostsearchresult_count_and_search(
)
self.assertEqual(estimate, 1)
self.assertIsInstance(products[0], EOProduct)
endpoint = "https://my.meteoblue.com/dataset/query"
default_geom = {
"coordinates": [
[[180, -90], [180, 90], [-180, 90], [-180, -90], [180, -90]]
],
"type": "Polygon",
}
# check downloadLink
self.assertEqual(
products[0].properties["downloadLink"],
f"{endpoint}?" + json.dumps({"geometry": default_geom, **custom_query}),
)
# check orderLink
self.assertEqual(
products[0].properties["orderLink"],
f"{endpoint}?"
+ json.dumps(
{"geometry": default_geom, "runOnJobQueue": True, **custom_query}
),
)


class MockResponse:
Expand Down

0 comments on commit 6ad35aa

Please sign in to comment.