Skip to content
Permalink
Browse files

server tests for json types in postgres

  • Loading branch information
signedav committed Oct 18, 2018
1 parent 4010e79 commit 4f55e9d8a2314d7ac105565f9d260eee80389e41
@@ -407,6 +407,26 @@ def testGetFeatureInfoTolerance(self):
'wms_getfeatureinfo_polygon_tolerance_20_text_xml',
'test_project_values.qgz')

def testGetFeatureInfoPostgresTypes(self):
#compare json list output with file
self.wms_request_compare('GetFeatureInfo',
'&layers=json' +
'&info_format=text%2Fxml' +
'&srs=EPSG%3A3857' +
'&QUERY_LAYERS=json' +
'&FILTER=json' + urllib.parse.quote(':"pk" = 1'),
'get_postgres_types_json_list',
'test_project_postgres_types.qgs')

#compare dict output with file
self.wms_request_compare('GetFeatureInfo',
'&layers=json' +
'&info_format=text%2Fxml' +
'&srs=EPSG%3A3857' +
'&QUERY_LAYERS=json' +
'&FILTER=json' + urllib.parse.quote(':"pk" = 2'),
'get_postgres_types_json_dict',
'test_project_postgres_types.qgs')

if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,13 @@
*****
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<BoundingBox maxy="0" maxx="0" miny="0" CRS="EPSG:3857" minx="0"/>
<Layer name="json">
<Feature id="2">
<Attribute value="2" name="pk"/>
<Attribute value="{&#xa; &quot;a&quot;: 1,&#xa; &quot;b&quot;: 2&#xa;}&#xa;" name="jvalue"/>
<Attribute value="{&#xa; &quot;c&quot;: 4,&#xa; &quot;d&quot;: 5&#xa;}&#xa;" name="jbvalue"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>
@@ -0,0 +1,13 @@
*****
Content-Type: text/xml; charset=utf-8

<GetFeatureInfoResponse>
<BoundingBox maxy="0" maxx="0" miny="0" CRS="EPSG:3857" minx="0"/>
<Layer name="json">
<Feature id="1">
<Attribute value="1" name="pk"/>
<Attribute value="[&#xa; 1,&#xa; 2,&#xa; 3&#xa;]&#xa;" name="jvalue"/>
<Attribute value="[&#xa; 4,&#xa; 5,&#xa; 6&#xa;]&#xa;" name="jbvalue"/>
</Feature>
</Layer>
</GetFeatureInfoResponse>
@@ -0,0 +1,254 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis projectname="" version="3.3.0-Master">
<homePath path=""/>
<title></title>
<autotransaction active="0"/>
<evaluateDefaultValues active="0"/>
<trust active="0"/>
<projectCrs>
<spatialrefsys>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</projectCrs>
<layer-tree-group>
<customproperties/>
<layer-tree-layer expanded="1" checked="Qt::Checked" source="dbname='qgis_test' port=5432 user='postgres' sslmode=disable key='pk' table=&quot;qgis_test&quot;.&quot;json&quot; sql=" providerKey="postgres" id="json_b2af056d_ba24_4fb7_805b_5a7720e242f3" name="json">
<customproperties/>
</layer-tree-layer>
<custom-order enabled="0"/>
</layer-tree-group>
<snapping-settings enabled="0" type="1" intersection-snapping="0" unit="2" tolerance="0" mode="2">
<individual-layer-settings/>
</snapping-settings>
<relations/>
<mapcanvas annotationsVisible="1" name="theMapCanvas">
<units>degrees</units>
<extent>
<xmin>8.20313020806923632</xmin>
<ymin>44.90118727027074641</ymin>
<xmax>8.20717330488028196</xmax>
<ymax>44.90224039332306205</ymax>
</extent>
<rotation>0</rotation>
<destinationsrs>
<spatialrefsys>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</destinationsrs>
<rendermaptile>0</rendermaptile>
</mapcanvas>
<projectModels/>
<legend updateDrawingOrder="true">
<legendlayer showFeatureCount="0" drawingOrder="-1" open="true" checked="Qt::Checked" name="json">
<filegroup open="true" hidden="false">
<legendlayerfile visible="1" layerid="json_b2af056d_ba24_4fb7_805b_5a7720e242f3" isInOverview="0"/>
</filegroup>
</legendlayer>
</legend>
<mapViewDocks/>
<projectlayers>
<maplayer maxScale="0" autoRefreshEnabled="0" hasScaleBasedVisibilityFlag="0" type="vector" refreshOnNotifyMessage="" autoRefreshTime="0" geometry="No geometry" styleCategories="AllStyleCategories" refreshOnNotifyEnabled="0" minScale="1e+8" readOnly="0">
<id>json_b2af056d_ba24_4fb7_805b_5a7720e242f3</id>
<datasource>dbname='qgis_test' port=5432 user='postgres' password='postgres' sslmode=disable key='pk' table="qgis_test"."json" sql=</datasource>
<keywordList>
<value></value>
</keywordList>
<layername>json</layername>
<srs>
<spatialrefsys>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</srs>
<resourceMetadata>
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type>dataset</type>
<title></title>
<abstract></abstract>
<links/>
<fees></fees>
<encoding></encoding>
<crs>
<spatialrefsys>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</crs>
<extent/>
</resourceMetadata>
<provider encoding="ISO-8859-5">postgres</provider>
<vectorjoins/>
<layerDependencies/>
<dataDependencies/>
<legend type="default-vector"/>
<expressionfields/>
<map-layer-style-manager current="default">
<map-layer-style name="default"/>
</map-layer-style-manager>
<auxiliaryLayer/>
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property key="dualview/previewExpressions" value="&quot;pk&quot;"/>
</customproperties>
<geometryOptions removeDuplicateNodes="0" geometryPrecision="0"/>
<fieldConfiguration>
<field name="pk">
<editWidget type="">
<config>
<Option/>
</config>
</editWidget>
</field>
<field name="jvalue">
<editWidget type="">
<config>
<Option/>
</config>
</editWidget>
</field>
<field name="jbvalue">
<editWidget type="">
<config>
<Option/>
</config>
</editWidget>
</field>
</fieldConfiguration>
<aliases>
<alias field="pk" index="0" name=""/>
<alias field="jvalue" index="1" name=""/>
<alias field="jbvalue" index="2" name=""/>
</aliases>
<excludeAttributesWMS/>
<excludeAttributesWFS/>
<defaults>
<default field="pk" applyOnUpdate="0" expression=""/>
<default field="jvalue" applyOnUpdate="0" expression=""/>
<default field="jbvalue" applyOnUpdate="0" expression=""/>
</defaults>
<constraints>
<constraint constraints="3" field="pk" notnull_strength="1" exp_strength="0" unique_strength="1"/>
<constraint constraints="0" field="jvalue" notnull_strength="0" exp_strength="0" unique_strength="0"/>
<constraint constraints="0" field="jbvalue" notnull_strength="0" exp_strength="0" unique_strength="0"/>
</constraints>
<constraintExpressions>
<constraint field="pk" exp="" desc=""/>
<constraint field="jvalue" exp="" desc=""/>
<constraint field="jbvalue" exp="" desc=""/>
</constraintExpressions>
<expressionfields/>
<attributeactions>
<defaultAction key="Canvas" value="{00000000-0000-0000-0000-000000000000}"/>
</attributeactions>
<attributetableconfig actionWidgetStyle="dropDown" sortOrder="0" sortExpression="">
<columns/>
</attributetableconfig>
<conditionalstyles>
<rowstyles/>
<fieldstyles/>
</conditionalstyles>
<editform tolerant="1"></editform>
<editforminit/>
<editforminitcodesource>0</editforminitcodesource>
<editforminitfilepath></editforminitfilepath>
<editforminitcode><![CDATA[]]></editforminitcode>
<featformsuppress>0</featformsuppress>
<editorlayout>generatedlayout</editorlayout>
<editable/>
<labelOnTop/>
<widgets/>
<previewExpression>"pk"</previewExpression>
<mapTip></mapTip>
</maplayer>
</projectlayers>
<layerorder/>
<properties>
<Measure>
<Ellipsoid type="QString">WGS84</Ellipsoid>
</Measure>
<SpatialRefSys>
<ProjectionsEnabled type="int">1</ProjectionsEnabled>
</SpatialRefSys>
<Gui>
<CanvasColorBluePart type="int">255</CanvasColorBluePart>
<CanvasColorGreenPart type="int">255</CanvasColorGreenPart>
<SelectionColorGreenPart type="int">255</SelectionColorGreenPart>
<SelectionColorBluePart type="int">0</SelectionColorBluePart>
<CanvasColorRedPart type="int">255</CanvasColorRedPart>
<SelectionColorAlphaPart type="int">255</SelectionColorAlphaPart>
<SelectionColorRedPart type="int">255</SelectionColorRedPart>
</Gui>
<PositionPrecision>
<DecimalPlaces type="int">2</DecimalPlaces>
<Automatic type="bool">true</Automatic>
</PositionPrecision>
<Legend>
<filterByMap type="bool">false</filterByMap>
</Legend>
<PAL>
<CandidatesPoint type="int">16</CandidatesPoint>
<CandidatesLine type="int">50</CandidatesLine>
<ShowingAllLabels type="bool">false</ShowingAllLabels>
<SearchMethod type="int">0</SearchMethod>
<DrawRectOnly type="bool">false</DrawRectOnly>
<CandidatesPolygon type="int">30</CandidatesPolygon>
<ShowingCandidates type="bool">false</ShowingCandidates>
<ShowingPartialsLabels type="bool">true</ShowingPartialsLabels>
<DrawOutlineLabels type="bool">true</DrawOutlineLabels>
</PAL>
<Paths>
<Absolute type="bool">false</Absolute>
</Paths>
<Measurement>
<DistanceUnits type="QString">meters</DistanceUnits>
<AreaUnits type="QString">m2</AreaUnits>
</Measurement>
</properties>
<visibility-presets/>
<transformContext/>
<projectMetadata>
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type></type>
<title></title>
<abstract></abstract>
<links/>
<author>David</author>
<creation>2018-10-17T15:28:25</creation>
</projectMetadata>
<Annotations/>
<Layouts/>
</qgis>

0 comments on commit 4f55e9d

Please sign in to comment.
You can’t perform that action at this time.