2929from shapely .geometry import box
3030
3131from eodag .utils import USER_AGENT , MockResponse
32+ from eodag import EOProduct
33+
3234from tests import mock
3335from 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
0 commit comments