@@ -2744,7 +2744,36 @@ def test_print_json_file_path(con100, tmp_path, path_factory):
27442744 assert path .read_text () == EXPECTED_JSON_EXPORT_S2_NDVI + "\n "
27452745
27462746
2747- def test_sar_backscatter_defaults (con100 ):
2747+ def test_sar_backscatter_defaults (con100 , requests_mock ):
2748+ requests_mock .get (API_URL , json = {"api_version" : "1.0.0" })
2749+ processes = [
2750+ {
2751+ "id" : "sar_backscatter" ,
2752+ "description" : "Computes backscatter from SAR input" ,
2753+ "summary" : "Computes backscatter from SAR input" ,
2754+ "parameters" : [
2755+ {
2756+ "default" : "gamma0-terrain" ,
2757+ "description" : "Select the radiometric correction coefficient." ,
2758+ "name" : "coefficient" ,
2759+ "schema" : [
2760+ {
2761+ "enum" : [
2762+ "beta0" ,
2763+ "sigma0-ellipsoid" ,
2764+ "sigma0-terrain" ,
2765+ "gamma0-ellipsoid" ,
2766+ "gamma0-terrain" ,
2767+ ],
2768+ "type" : "string" ,
2769+ },
2770+ ],
2771+ },
2772+ ],
2773+ "returns" : {"description" : "incremented value" , "schema" : {"type" : "integer" }},
2774+ }
2775+ ]
2776+ requests_mock .get (API_URL + "/processes" , json = {"processes" : processes })
27482777 cube = con100 .load_collection ("S2" ).sar_backscatter ()
27492778 assert _get_leaf_node (cube ) == {
27502779 "process_id" : "sar_backscatter" ,
@@ -2762,7 +2791,36 @@ def test_sar_backscatter_defaults(con100):
27622791 }
27632792
27642793
2765- def test_sar_backscatter_custom (con100 ):
2794+ def test_sar_backscatter_custom (con100 , requests_mock ):
2795+ requests_mock .get (API_URL , json = {"api_version" : "1.0.0" })
2796+ processes = [
2797+ {
2798+ "id" : "sar_backscatter" ,
2799+ "description" : "Computes backscatter from SAR input" ,
2800+ "summary" : "Computes backscatter from SAR input" ,
2801+ "parameters" : [
2802+ {
2803+ "default" : "gamma0-terrain" ,
2804+ "description" : "Select the radiometric correction coefficient." ,
2805+ "name" : "coefficient" ,
2806+ "schema" : [
2807+ {
2808+ "enum" : [
2809+ "beta0" ,
2810+ "sigma0-ellipsoid" ,
2811+ "sigma0-terrain" ,
2812+ "gamma0-ellipsoid" ,
2813+ "gamma0-terrain" ,
2814+ ],
2815+ "type" : "string" ,
2816+ },
2817+ ],
2818+ },
2819+ ],
2820+ "returns" : {"description" : "incremented value" , "schema" : {"type" : "integer" }},
2821+ }
2822+ ]
2823+ requests_mock .get (API_URL + "/processes" , json = {"processes" : processes })
27662824 cube = con100 .load_collection ("S2" )
27672825 cube = cube .sar_backscatter (
27682826 coefficient = "sigma0-ellipsoid" ,
@@ -2786,13 +2844,71 @@ def test_sar_backscatter_custom(con100):
27862844 }
27872845
27882846
2789- def test_sar_backscatter_coefficient_none (con100 ):
2847+ def test_sar_backscatter_coefficient_none (con100 , requests_mock ):
2848+ requests_mock .get (API_URL , json = {"api_version" : "1.0.0" })
2849+ processes = [
2850+ {
2851+ "id" : "sar_backscatter" ,
2852+ "description" : "Computes backscatter from SAR input" ,
2853+ "summary" : "Computes backscatter from SAR input" ,
2854+ "parameters" : [
2855+ {
2856+ "default" : "gamma0-terrain" ,
2857+ "description" : "Select the radiometric correction coefficient." ,
2858+ "name" : "coefficient" ,
2859+ "schema" : [
2860+ {
2861+ "enum" : [
2862+ "beta0" ,
2863+ "sigma0-ellipsoid" ,
2864+ "sigma0-terrain" ,
2865+ "gamma0-ellipsoid" ,
2866+ "gamma0-terrain" ,
2867+ ],
2868+ "type" : "string" ,
2869+ },
2870+ ],
2871+ },
2872+ ],
2873+ "returns" : {"description" : "incremented value" , "schema" : {"type" : "integer" }},
2874+ }
2875+ ]
2876+ requests_mock .get (API_URL + "/processes" , json = {"processes" : processes })
27902877 cube = con100 .load_collection ("S2" )
27912878 cube = cube .sar_backscatter (coefficient = None )
27922879 assert _get_leaf_node (cube )["arguments" ]["coefficient" ] is None
27932880
27942881
2795- def test_sar_backscatter_coefficient_invalid (con100 ):
2882+ def test_sar_backscatter_coefficient_invalid (con100 , requests_mock ):
2883+ requests_mock .get (API_URL , json = {"api_version" : "1.0.0" })
2884+ processes = [
2885+ {
2886+ "id" : "sar_backscatter" ,
2887+ "description" : "Computes backscatter from SAR input" ,
2888+ "summary" : "Computes backscatter from SAR input" ,
2889+ "parameters" : [
2890+ {
2891+ "default" : "gamma0-terrain" ,
2892+ "description" : "Select the radiometric correction coefficient." ,
2893+ "name" : "coefficient" ,
2894+ "schema" : [
2895+ {
2896+ "enum" : [
2897+ "beta0" ,
2898+ "sigma0-ellipsoid" ,
2899+ "sigma0-terrain" ,
2900+ "gamma0-ellipsoid" ,
2901+ "gamma0-terrain" ,
2902+ ],
2903+ "type" : "string" ,
2904+ },
2905+ ],
2906+ },
2907+ ],
2908+ "returns" : {"description" : "incremented value" , "schema" : {"type" : "integer" }},
2909+ }
2910+ ]
2911+ requests_mock .get (API_URL + "/processes" , json = {"processes" : processes })
27962912 cube = con100 .load_collection ("S2" )
27972913 with pytest .raises (OpenEoClientException , match = "Invalid.*coef.*unicorn.*Should.*sigma0-ellipsoid.*gamma0-terrain" ):
27982914 cube .sar_backscatter (coefficient = "unicorn" )
0 commit comments