2828from fastapi .testclient import TestClient
2929from shapely .geometry import box
3030
31+ from eodag import EOProduct
3132from tests import mock
3233from tests .context import (
3334 DEFAULT_ITEMS_PER_PAGE ,
@@ -1000,7 +1001,7 @@ def test_download_item_from_collection_api_plugin(self, mock_download, mock_auth
10001001 ), f"File { expected_file } should have been deleted"
10011002
10021003 @mock .patch (
1003- "eodag.rest.utils.eodag_api._plugins_manager.get_search_plugins " ,
1004+ "eodag.plugins.search.qssearch.QueryStringSearch.query " ,
10041005 autospec = True ,
10051006 )
10061007 @mock .patch (
@@ -1013,20 +1014,25 @@ def test_download_item_from_collection_api_plugin(self, mock_download, mock_auth
10131014 )
10141015 def test_download_without_search_by_id (self , mock_download , mock_auth , mock_plugin ):
10151016 product_id = "a_nice_product"
1016- download_info = {
1017- product_id : {
1018- "downloadLink" : "https://bla.bli" ,
1019- "orderLink" : "https://bla.bli/blu" ,
1020- "provider " : "onda " ,
1021- }
1017+ properties = {
1018+ "id" : product_id ,
1019+ "downloadLink" : "https://bla.bli" ,
1020+ "orderLink" : "https://bla.bli/blu" ,
1021+ "geometry " : "-180 -90 180 90 " ,
1022+ "title" : product_id ,
10221023 }
1023- plugin_mock_value = mock .MagicMock (download_info = download_info )
1024- mock_plugin .return_value = iter ([plugin_mock_value ])
1024+ product = EOProduct ("onda" , properties , productType = self .tested_product_type )
1025+ mock_plugin .return_value = [product ], 1
1026+ # search products
1027+ self .app .get (
1028+ f"search?collections={ self .tested_product_type } &bbox=0,43,1,44&datetime=2018-01-20/2018-01-25" ,
1029+ follow_redirects = True ,
1030+ )
10251031
10261032 mock_download .return_value = {"content" : iter (["" ])}
1027- # check that download request is working without attempt to execute search
1033+ # check that download of returned product is working without attempt to execute search
10281034 self ._request_valid_raw (
1029- f"collections/some-collection /items/{ product_id } /download?provider=onda " ,
1035+ f"collections/{ self . tested_product_type } /items/a_nice_product /download?provider=peps " ,
10301036 search_call_count = 0 ,
10311037 )
10321038
0 commit comments