@@ -428,5 +428,43 @@ def testGetFeatureInfoPostgresTypes(self):
428
428
'get_postgres_types_json_dict' ,
429
429
'test_project_postgres_types.qgs' )
430
430
431
+ #compare decoded json field list
432
+ response_header , response_body , query_string = self .wms_request ('GetFeatureInfo' ,
433
+ '&layers=json' +
434
+ '&info_format=text%2Fxml' +
435
+ '&srs=EPSG%3A3857' +
436
+ '&QUERY_LAYERS=json' +
437
+ '&FILTER=json' + urllib .parse .quote (':"pk" = 1' ),
438
+ 'test_project_postgres_types.qgs' )
439
+ root = ET .fromstring (response_body )
440
+ for attribute in root .iter ('Attribute' ):
441
+ if attribute .get ('name' ) == 'jvalue' :
442
+ self .assertIsInstance (attribute .get ('value' ), list )
443
+ self .assertEqual (attribute .get ('value' ), [1 , 2 , 3 ])
444
+ self .assertEqual (attribute .get ('value' ), [1.0 , 2.0 , 3.0 ])
445
+ if attribute .get ('name' ) == 'jbvalue' :
446
+ self .assertIsInstance (attribute .get ('value' ), list )
447
+ self .assertEqual (attribute .get ('value' ), [4 , 5 , 6 ])
448
+ self .assertEqual (attribute .get ('value' ), [4.0 , 5.0 , 6.0 ])
449
+
450
+ #compare decoded json field dict
451
+ response_header , response_body , query_string = self .wms_request ('GetFeatureInfo' ,
452
+ '&layers=json' +
453
+ '&info_format=text%2Fxml' +
454
+ '&srs=EPSG%3A3857' +
455
+ '&QUERY_LAYERS=json' +
456
+ '&FILTER=json' + urllib .parse .quote (':"pk" = 2' ),
457
+ 'test_project_postgres_types.qgs' )
458
+ root = ET .fromstring (response_body )
459
+ for attribute in root .iter ('Attribute' ):
460
+ if attribute .get ('name' ) == 'jvalue' :
461
+ self .assertIsInstance (attribute .get ('value' ), dict )
462
+ self .assertEqual (attribute .get ('value' ), {'a' : 1 , 'b' : 2 })
463
+ self .assertEqual (attribute .get ('value' ), {'a' : 1.0 , 'b' : 2.0 })
464
+ if attribute .get ('name' ) == 'jbvalue' :
465
+ self .assertIsInstance (attribute .get ('value' ), dict )
466
+ self .assertEqual (attribute .get ('value' ), {'c' : 4 , 'd' : 5 })
467
+ self .assertEqual (attribute .get ('value' ), {'c' : 4.0 , 'd' : 5.0 })
468
+
431
469
if __name__ == '__main__' :
432
470
unittest .main ()
0 commit comments