3131 not_implemented ,
3232)
3333from openeo_driver .config import OpenEoBackendConfig
34+ from openeo_driver .constants import ITEM_LINK_PROPERTY
3435from openeo_driver .datacube import DriverVectorCube
3536from openeo_driver .dummy import dummy_backend , dummy_config
3637from openeo_driver .dummy .dummy_backend import DummyBackendImplementation , DummyProcessing , DummyProcessRegistry
@@ -3004,6 +3005,14 @@ def test_get_stac_1_1_item(self, api110, backend_implementation, backend_config_
30043005 "id" : "5d2db643-5cc3-4b27-8ef3-11f7d203b221_2023-12-31T21:41:00Z" ,
30053006 "properties" : {"datetime" : "2023-12-31T21:41:00Z" },
30063007 "bbox" : [3.359808992021044 , 51.08284561357965 , 4.690166134878123 , 51.88641704215104 ],
3008+ "links" : [
3009+ {
3010+ "rel" : "custom" ,
3011+ "href" : "/data/projects/OpenEO/07024ee9-7847-4b8a-b260-6c879a2b3cdc/07024ee9-7847-4b8a-b260-6c879a2b3cdc_input_items_9569134155392213115.json" ,
3012+ "type" : "application/json" ,
3013+ ITEM_LINK_PROPERTY .EXPOSE_AUXILIARY : True ,
3014+ },
3015+ ],
30073016 }
30083017 }
30093018 ),
@@ -3042,10 +3051,16 @@ def test_get_stac_1_1_item(self, api110, backend_implementation, backend_config_
30423051 'type' : 'application/geo+json'
30433052 },
30443053 {
3045- 'href' : 'http://oeo.net/openeo/1.1.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results' ,
3046- 'rel' : 'collection' ,
3047- 'type' : 'application/json'
3048- }
3054+ "href" : "http://oeo.net/openeo/1.1.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results" ,
3055+ "rel" : "collection" ,
3056+ "type" : "application/json" ,
3057+ },
3058+ {
3059+ "rel" : "custom" ,
3060+ # TODO: what does the URL look like? Currently /aux instead of /assets; should /items be in there?
3061+ "href" : "http://oeo.net/openeo/1.1.0/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/aux/TXIuVGVzdA==/a0274432f627ca9cf9b4ff79d57c61bd/07024ee9-7847-4b8a-b260-6c879a2b3cdc_input_items_9569134155392213115.json" ,
3062+ "type" : "application/json" ,
3063+ },
30493064 ],
30503065 'properties' : {'datetime' : '2023-12-31T21:41:00Z' },
30513066 'stac_extensions' : ['https://stac-extensions.github.io/eo/v1.1.0/schema.json' ,
@@ -3055,6 +3070,99 @@ def test_get_stac_1_1_item(self, api110, backend_implementation, backend_config_
30553070 'type' : 'Feature'
30563071 }
30573072
3073+ @mock .patch ("time.time" , mock .MagicMock (return_value = 1234 ))
3074+ @pytest .mark .parametrize ("backend_config_overrides" , [{"url_signer" : UrlSigner (secret = "123&@#" , expiration = 1000 )}])
3075+ def test_download_job_auxiliary_file_signed_with_expiration (self , api110 , tmp_path , backend_config_overrides ):
3076+ job_id = "07024ee9-7847-4b8a-b260-6c879a2b3cdc"
3077+ job_dir = tmp_path
3078+ auxiliary_file = job_dir / "07024ee9-7847-4b8a-b260-6c879a2b3cdc_input_items_9569134155392213115.json"
3079+
3080+ with open (auxiliary_file , "w" ) as f :
3081+ f .write ("aux" )
3082+
3083+ with self ._fresh_job_registry ():
3084+ dummy_backend .DummyBatchJobs .set_result_metadata (
3085+ job_id = job_id ,
3086+ user_id = TEST_USER ,
3087+ metadata = BatchJobResultMetadata (
3088+ items = {
3089+ "5d2db643-5cc3-4b27-8ef3-11f7d203b221_2023-12-31T21:41:00Z" : {
3090+ "geometry" : {
3091+ "coordinates" : [
3092+ [
3093+ [3.359808992021044 , 51.08284561357965 ],
3094+ [3.359808992021044 , 51.88641704215104 ],
3095+ [4.690166134878123 , 51.88641704215104 ],
3096+ [4.690166134878123 , 51.08284561357965 ],
3097+ [3.359808992021044 , 51.08284561357965 ],
3098+ ]
3099+ ],
3100+ "type" : "Polygon" ,
3101+ },
3102+ "assets" : {
3103+ "openEO" : {
3104+ "datetime" : "2023-12-31T21:41:00Z" ,
3105+ "roles" : ["data" ],
3106+ "bbox" : [
3107+ 3.359808992021044 ,
3108+ 51.08284561357965 ,
3109+ 4.690166134878123 ,
3110+ 51.88641704215104 ,
3111+ ],
3112+ "geometry" : {
3113+ "coordinates" : [
3114+ [
3115+ [3.359808992021044 , 51.08284561357965 ],
3116+ [3.359808992021044 , 51.88641704215104 ],
3117+ [4.690166134878123 , 51.88641704215104 ],
3118+ [4.690166134878123 , 51.08284561357965 ],
3119+ [3.359808992021044 , 51.08284561357965 ],
3120+ ]
3121+ ],
3122+ "type" : "Polygon" ,
3123+ },
3124+ "href" : "s3://openeo-data-staging-waw4-1/batch_jobs/j-250605095828442799fdde3c29b5b047/openEO_20231231T214100Z.tif" ,
3125+ "nodata" : "nan" ,
3126+ "type" : "image/tiff; application=geotiff" ,
3127+ "bands" : [
3128+ {"name" : "LST" , "common_name" : "surface_temperature" , "aliases" : ["LST_in:LST" ]}
3129+ ],
3130+ "raster:bands" : [
3131+ {
3132+ "name" : "LST" ,
3133+ "statistics" : {
3134+ "valid_percent" : 66.88 ,
3135+ "maximum" : 281.04800415039 ,
3136+ "stddev" : 19.598456945276 ,
3137+ "minimum" : 224.46798706055 ,
3138+ "mean" : 259.57087672984 ,
3139+ },
3140+ }
3141+ ],
3142+ }
3143+ },
3144+ "id" : "5d2db643-5cc3-4b27-8ef3-11f7d203b221_2023-12-31T21:41:00Z" ,
3145+ "properties" : {"datetime" : "2023-12-31T21:41:00Z" },
3146+ "bbox" : [3.359808992021044 , 51.08284561357965 , 4.690166134878123 , 51.88641704215104 ],
3147+ "links" : [
3148+ {
3149+ "rel" : "custom" ,
3150+ "href" : str (auxiliary_file ),
3151+ "type" : "application/json" ,
3152+ ITEM_LINK_PROPERTY .EXPOSE_AUXILIARY : True ,
3153+ },
3154+ ],
3155+ }
3156+ }
3157+ ),
3158+ )
3159+
3160+ resp = api110 .get (
3161+ "/jobs/07024ee9-7847-4b8a-b260-6c879a2b3cdc/results/aux/TXIuVGVzdA==/5b3d0f30d2ad8ef3146dc0785821aac3/07024ee9-7847-4b8a-b260-6c879a2b3cdc_input_items_9569134155392213115.json?expires=2234" ,
3162+ )
3163+
3164+ assert resp .text == "aux"
3165+
30583166 def test_get_job_results_invalid_job (self , api ):
30593167 api .get ("/jobs/deadbeef-f00/results" , headers = self .AUTH_HEADER ).assert_error (404 , "JobNotFound" )
30603168
0 commit comments