@@ -4728,24 +4728,19 @@ def testWFST11(self):
4728
4728
| QgsVectorDataProvider .SelectAtId )
4729
4729
4730
4730
# Transaction response failure (no modifications)
4731
- shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_empty.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http://www .opengis.net/wfs " xmlns:xsi="http://www .w3.org/2001/XMLSchema -instance" xmlns:gml="http://www .opengis.net/gml " xmlns:ws1="ws1" xsi:schemaLocation="ws1 http://localhost:8600/geoserver/ws1/wfs?SERVICE=WFS& REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Insert xmlns="http://www .opengis.net/wfs "><polygons xmlns="ws1"/></Insert></Transaction >' ))
4731
+ shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_empty.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http:__www .opengis.net_wfs " xmlns:xsi="http:__www .w3.org_2001_XMLSchema -instance" xmlns:gml="http:__www .opengis.net_gml " xmlns:ws1="ws1" xsi:schemaLocation="ws1 http:__fake_qgis_http_endpoint? REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Insert xmlns="http:__www .opengis.net_wfs "><polygons xmlns="ws1"_><_Insert><_Transaction >' ))
4732
4732
4733
4733
(ret , _ ) = vl .dataProvider ().addFeatures ([QgsFeature ()])
4734
4734
self .assertFalse (ret )
4735
-
4736
4735
self .assertEqual (vl .featureCount (), 0 )
4737
-
4738
4736
self .assertFalse (vl .dataProvider ().deleteFeatures ([0 ]))
4739
-
4740
4737
self .assertEqual (vl .featureCount (), 0 )
4741
-
4742
4738
self .assertFalse (vl .dataProvider ().changeGeometryValues ({0 : QgsGeometry .fromWkt ('Polygon ((9 45, 10 45, 10 46, 9 46, 9 45))' )}))
4743
-
4744
4739
self .assertFalse (vl .dataProvider ().changeAttributeValues ({0 : {0 : 0 }}))
4745
4740
4746
4741
# Test add features for real
4747
4742
# Transaction response with 1 feature added
4748
- shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_feature_added.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http://www .opengis.net/wfs " xmlns:xsi="http://www .w3.org/2001/XMLSchema -instance" xmlns:gml="http://www .opengis.net/gml " xmlns:ws1="ws1" xsi:schemaLocation="ws1 http://fake_qgis_http_endpoint ?REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Insert xmlns="http://www .opengis.net/wfs "><polygons xmlns="ws1"><name xmlns="ws1">one</name ><value xmlns="ws1">1</value ><geometry xmlns="ws1"><gml:Polygon srsName="EPSG:4326"><gml:exterior ><gml:LinearRing><gml:posList srsDimension="2">9 45 10 45 10 46 9 46 9 45</gml:posList></gml :LinearRing></gml:exterior></gml :Polygon></geometry></polygons></Insert></Transaction >' ))
4743
+ shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_feature_added.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http:__www .opengis.net_wfs " xmlns:xsi="http:__www .w3.org_2001_XMLSchema -instance" xmlns:gml="http:__www .opengis.net_gml " xmlns:ws1="ws1" xsi:schemaLocation="ws1 http:__fake_qgis_http_endpoint ?REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Insert xmlns="http:__www .opengis.net_wfs "><polygons xmlns="ws1"><name xmlns="ws1">one<_name ><value xmlns="ws1">1<_value ><geometry xmlns="ws1"><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs ><gml:LinearRing><gml:coordinates cs="," ts=" ">9, 45 10, 45 10, 46 9, 46 9, 45<_gml:coordinates><_gml :LinearRing><_gml:outerBoundaryIs><_gml :Polygon><_geometry><_polygons><_Insert><_Transaction >' ))
4749
4744
4750
4745
feat = QgsFeature (vl .fields ())
4751
4746
feat .setAttribute ('name' , 'one' )
@@ -4764,9 +4759,10 @@ def testWFST11(self):
4764
4759
4765
4760
# Test change geometry
4766
4761
# Transaction response with 1 feature changed
4767
- shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_feature_changed.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:ws1="ws1" xsi:schemaLocation="ws1 http://fake_qgis_http_endpoint?REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Update xmlns="http://www.opengis.net/wfs" typeName="ws1:polygons"><Property xmlns="http://www.opengis.net/wfs"><Name xmlns="http://www.opengis.net/wfs">ws1:geometry</Name><Value xmlns="http://www.opengis.net/wfs"><gml:Polygon srsName="EPSG:4326"><gml:exterior><gml:LinearRing><gml:posList srsDimension="2">10 46 11 46 11 47 10 47 10 46</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></Value></Property><Filter xmlns="http://www.opengis.net/ogc"><FeatureId xmlns="http://www.opengis.net/ogc" fid="123"/></Filter></Update></Transaction>' ))
4762
+ shutil .copy (os .path .join (TEST_DATA_DIR , 'provider' , 'wfst-1-1' , 'transaction_response_feature_changed.xml' ), sanitize (endpoint , '?SERVICE=WFS&POSTDATA=<Transaction xmlns="http:__www.opengis.net_wfs" xmlns:xsi="http:__www.w3.org_2001_XMLSchema-instance" xmlns:gml="http:__www.opengis.net_gml" xmlns:ws1="ws1" xsi:schemaLocation="ws1 http:__fake_qgis_http_endpoint?REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=ws1:polygons" version="1.1.0" service="WFS"><Update xmlns="http:__www.opengis.net_wfs" typeName="ws1:polygons"><Property xmlns="http:__www.opengis.net_wfs"><Name xmlns="http:__www.opengis.net_wfs">ws1:geometry<_Name><Value xmlns="http:__www.opengis.net_wfs"><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates cs="," ts=" ">10,46 11,46 11,47 10,47 10,46<_gml:coordinates><_gml:LinearRing><_gml:outerBoundaryIs><_gml:Polygon><_Value><_Property><Filter xmlns="http:__www.opengis.net_ogc"><FeatureId xmlns="http:__www.opengis.net_ogc" fid="123"_><_Filter><_Update><_Transaction>' ))
4768
4763
4769
4764
new_geom = QgsGeometry .fromWkt ('Polygon ((10 46, 11 46, 11 47, 10 47, 10 46))' )
4765
+
4770
4766
self .assertTrue (vl .dataProvider ().changeGeometryValues ({1 : new_geom }))
4771
4767
self .assertEqual (next (vl .dataProvider ().getFeatures ()).geometry ().asWkt (), new_geom .asWkt ())
4772
4768
0 commit comments