Skip to content

Commit f59180a

Browse files
committed
test: fix tests after refactoring and rebase
1 parent d0a189c commit f59180a

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

tests/units/test_http_server.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from shapely.geometry import box
3030

3131
from eodag.utils import USER_AGENT, MockResponse
32+
from eodag import EOProduct
33+
3234
from tests import mock
3335
from tests.context import (
3436
DEFAULT_ITEMS_PER_PAGE,
@@ -1009,7 +1011,7 @@ def test_download_item_from_collection_api_plugin(self, mock_download, mock_auth
10091011
), f"File {expected_file} should have been deleted"
10101012

10111013
@mock.patch(
1012-
"eodag.rest.utils.eodag_api._plugins_manager.get_search_plugins",
1014+
"eodag.plugins.search.qssearch.QueryStringSearch.query",
10131015
autospec=True,
10141016
)
10151017
@mock.patch(
@@ -1022,20 +1024,25 @@ def test_download_item_from_collection_api_plugin(self, mock_download, mock_auth
10221024
)
10231025
def test_download_without_search_by_id(self, mock_download, mock_auth, mock_plugin):
10241026
product_id = "a_nice_product"
1025-
download_info = {
1026-
product_id: {
1027-
"downloadLink": "https://bla.bli",
1028-
"orderLink": "https://bla.bli/blu",
1029-
"provider": "onda",
1030-
}
1027+
properties = {
1028+
"id": product_id,
1029+
"downloadLink": "https://bla.bli",
1030+
"orderLink": "https://bla.bli/blu",
1031+
"geometry": "-180 -90 180 90",
1032+
"title": product_id,
10311033
}
1032-
plugin_mock_value = mock.MagicMock(download_info=download_info)
1033-
mock_plugin.return_value = iter([plugin_mock_value])
1034+
product = EOProduct("onda", properties, productType=self.tested_product_type)
1035+
mock_plugin.return_value = [product], 1
1036+
# search products
1037+
self.app.get(
1038+
f"search?collections={self.tested_product_type}&bbox=0,43,1,44&datetime=2018-01-20/2018-01-25",
1039+
follow_redirects=True,
1040+
)
10341041

10351042
mock_download.return_value = {"content": iter([""])}
1036-
# check that download request is working without attempt to execute search
1043+
# check that download of returned product is working without attempt to execute search
10371044
self._request_valid_raw(
1038-
f"collections/some-collection/items/{product_id}/download?provider=onda",
1045+
f"collections/{self.tested_product_type}/items/a_nice_product/download?provider=peps",
10391046
search_call_count=0,
10401047
)
10411048

tests/units/test_search_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ def test_plugins_search_odatav4search_distinct_product_type_mtd_mapping(
11101110
],
11111111
}
11121112
copy_res = copy.deepcopy(result)
1113-
mock__request.return_value.json.side_effect = [result, copy_res]
1113+
mock__request.return_value.json.side_effect = [3, result, 3, copy_res]
11141114
search_plugin = self.onda_search_plugin
11151115

11161116
# update metadata_mapping only for S1_SAR_GRD

0 commit comments

Comments
 (0)