@@ -35,25 +35,24 @@ def setUpClass(cls):
35
35
36
36
bbox1 = BBox ([- 90.9216499 , 14.4190528 , - 90.8186531 , 14.5520163 ], crs = CRS .WGS84 ) # From examples
37
37
bbox2 = BBox ([46.16 , - 16.15 , 46.51 , - 15.58 ], crs = CRS .WGS84 ) # From sentinelhub-py examples
38
- custom_url_params = {
38
+ cls . custom_url_params = {
39
39
CustomUrlParam .SHOWLOGO : True ,
40
40
CustomUrlParam .TRANSPARENT : False ,
41
41
CustomUrlParam .EVALSCRIPT : 'return [B01]' ,
42
42
CustomUrlParam .ATMFILTER : 'DOS1'
43
43
}
44
44
45
- wms_request = WmsRequest (layer = 'BANDS-S2-L1C' , bbox = bbox1 , time = ('2017-12-01' , '2017-12-31' ), width = 60 ,
46
- height = None , image_format = MimeType .TIFF , custom_url_params = custom_url_params ,
47
- instance_id = cls .CONFIG .instance_id )
48
- wcs_request = WcsRequest (layer = 'TRUE-COLOR-S2-L1C' , bbox = bbox2 , time = '2016-07-18T07:14:04' ,
49
- resx = '100m' , resy = '100m' ,
50
- image_format = MimeType .PNG , data_folder = '.' )
45
+ cls .wms_request = WmsRequest (layer = 'BANDS-S2-L1C' , bbox = bbox1 , time = ('2017-12-01' , '2017-12-31' ), width = 60 ,
46
+ height = None , image_format = MimeType .TIFF , custom_url_params = cls .custom_url_params ,
47
+ instance_id = cls .CONFIG .instance_id )
48
+ cls .wcs_request = WcsRequest (layer = 'TRUE-COLOR-S2-L1C' , bbox = bbox2 , time = '2016-07-18T07:14:04' ,
49
+ resx = '100m' , resy = '100m' , image_format = MimeType .PNG , data_folder = '.' )
51
50
52
51
cls .test_cases = [
53
- TestCaseContainer ('WMS' , CloudMaskRequest (wms_request , threshold = 0.6 , average_over = 2 , dilation_size = 5 ),
52
+ TestCaseContainer ('WMS' , CloudMaskRequest (cls . wms_request , threshold = 0.6 , average_over = 2 , dilation_size = 5 ),
54
53
clm_min = 0 , clm_max = 1 , clm_mean = 0.343827 , clm_median = 0 , clp_min = 0.00011 , clp_max = 0.99999 ,
55
54
clp_mean = 0.23959 , clp_median = 0.01897 , mask_shape = (7 , 81 , 60 )),
56
- TestCaseContainer ('WCS, partial no data' , CloudMaskRequest (wcs_request , all_bands = True ), clm_min = 0 ,
55
+ TestCaseContainer ('WCS, partial no data' , CloudMaskRequest (cls . wcs_request , all_bands = True ), clm_min = 0 ,
57
56
clm_max = 1 , clm_mean = 0.04468 , clm_median = 0 , clp_min = - 50.0 , clp_max = 0.999635 ,
58
57
clp_mean = - 7.72785 , clp_median = 0.011568 , mask_shape = (1 , 634 , 374 ))
59
58
]
@@ -76,6 +75,15 @@ def test_get_cloud_probabilities(self):
76
75
exp_mean = test_case .clp_mean , exp_median = test_case .clp_median ,
77
76
test_name = test_case .name , delta = 1e-4 )
78
77
78
+ def test_requests_unchanged (self ):
79
+ self .assertEqual (self .wms_request .custom_url_params , self .custom_url_params ,
80
+ msg = 'Custom url params were changed' )
81
+ self .assertTrue (self .wms_request .custom_url_params [CustomUrlParam .SHOWLOGO ],
82
+ msg = 'Custom url params were changed' )
83
+
84
+ self .assertEqual (self .wms_request .image_format , MimeType .TIFF , msg = 'Image format of WMS class was changed' )
85
+ self .assertEqual (self .wcs_request .image_format , MimeType .PNG , msg = 'Image format of WCS class was changed' )
86
+
79
87
80
88
if __name__ == '__main__' :
81
89
unittest .main ()
0 commit comments