66import json
77import pytest
88
9- SERVICE_URL = 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288'
10-
9+ SERVICE_URL = 'https://services.ga.gov.au/gis/stratunits/ows'
1110
1211def test_caps_info ():
1312 getcapsin = open (resource_file ("wfs_HSRS_GetCapabilities_1_1_0.xml" ), "rb" ).read ()
@@ -59,59 +58,50 @@ def test_verbOptions_wfs_100():
5958 assert len (verbOptions [0 ]) == 2
6059
6160
62- @pytest .mark .xfail
6361@pytest .mark .online
6462@pytest .mark .skipif (not service_ok (SERVICE_URL ),
6563 reason = "WFS service is unreachable" )
6664def test_outputformat_wfs_100 ():
67- wfs = WebFeatureService ('https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
68- version = '1.0.0' )
65+ wfs = WebFeatureService (SERVICE_URL , version = '1.0.0' )
6966 feature = wfs .getfeature (
70- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
67+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
7168 assert len (json .loads (feature .read ())['features' ]) == 1
7269
7370
74- @pytest .mark .xfail
7571@pytest .mark .online
7672@pytest .mark .skipif (not service_ok (SERVICE_URL ),
7773 reason = "WFS service is unreachable" )
7874def test_outputformat_wfs_110 ():
79- wfs = WebFeatureService ('https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
80- version = '1.1.0' )
75+ wfs = WebFeatureService (SERVICE_URL , version = '1.1.0' )
8176 feature = wfs .getfeature (
82- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
77+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
8378 assert len (json .loads (feature .read ())['features' ]) == 1
8479
8580
86- @pytest .mark .xfail
8781@pytest .mark .online
8882@pytest .mark .skipif (not service_ok (SERVICE_URL ),
8983 reason = "WFS service is unreachable" )
9084def test_outputformat_wfs_200 ():
91- wfs = WebFeatureService ('https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
92- version = '2.0.0' )
85+ wfs = WebFeatureService (SERVICE_URL , version = '2.0.0' )
9386 feature = wfs .getfeature (
94- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
87+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' )
9588 assert len (json .loads (feature .read ())['features' ]) == 1
9689
9790
98- @pytest .mark .xfail
9991@pytest .mark .online
10092@pytest .mark .skipif (not service_ok (SERVICE_URL ),
10193 reason = "WFS service is unreachable" )
10294def test_srsname_wfs_100 ():
103- wfs = WebFeatureService ('https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
104- version = '1.0.0' )
95+ wfs = WebFeatureService (SERVICE_URL , version = '1.0.0' )
10596 # ServiceException: Unable to support srsName: EPSG:99999999
10697 with pytest .raises (ServiceException ):
10798 feature = wfs .getfeature (
108- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
99+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
109100 srsname = "EPSG:99999999" )
110101
111- wfs = WebFeatureService ('https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
112- version = '1.0.0' )
102+ wfs = WebFeatureService (SERVICE_URL , version = '1.0.0' )
113103 feature = wfs .getfeature (
114- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
104+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
115105 srsname = "urn:x-ogc:def:crs:EPSG:4326" )
116106 assert len (json .loads (feature .read ())['features' ]) == 1
117107
@@ -121,73 +111,76 @@ def test_srsname_wfs_100():
121111@pytest .mark .skipif (not service_ok (SERVICE_URL ),
122112 reason = "WFS service is unreachable" )
123113def test_srsname_wfs_110 ():
124- wfs = WebFeatureService (
125- 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
126- version = '1.1.0' )
114+ wfs = WebFeatureService (SERVICE_URL , version = '1.1.0' )
127115 # ServiceException: Unable to support srsName: EPSG:99999999
128116 with pytest .raises (ServiceException ):
129117 feature = wfs .getfeature (
130- typename = ['sb:Project_Area ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
118+ typename = ['stratunit:StratigraphicUnit ' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
131119 srsname = "EPSG:99999999" )
132120
133- wfs = WebFeatureService (
134- 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
135- version = '1.0.0' )
121+ wfs = WebFeatureService (SERVICE_URL , version = '1.1.0' )
136122 feature = wfs .getfeature (
137- typename = ['sb:Project_Area' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
123+ typename = ['stratunit:StratigraphicUnit' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
124+ srsname = "urn:x-ogc:def:crs:EPSG:4326" )
125+ assert len (json .loads (feature .read ())['features' ]) == 1
126+
127+
128+ @pytest .mark .online
129+ @pytest .mark .skipif (not service_ok (SERVICE_URL ),
130+ reason = "WFS service is unreachable" )
131+ def test_srsname_wfs_200 ():
132+ wfs = WebFeatureService (SERVICE_URL , version = '2.0.0' )
133+ # ServiceException: Unable to support srsName: EPSG:99999999
134+ with pytest .raises (ServiceException ):
135+ feature = wfs .getfeature (
136+ typename = ['stratunit:StratigraphicUnit' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
137+ srsname = "EPSG:99999999" )
138+
139+ wfs = WebFeatureService (SERVICE_URL , version = '2.0.0' )
140+ feature = wfs .getfeature (
141+ typename = ['stratunit:StratigraphicUnit' ], maxfeatures = 1 , propertyname = None , outputFormat = 'application/json' ,
138142 srsname = "urn:x-ogc:def:crs:EPSG:4326" )
139143 assert len (json .loads (feature .read ())['features' ]) == 1
140144
141145
142- @pytest .mark .xfail
143146@pytest .mark .online
144147@pytest .mark .skipif (not service_ok (SERVICE_URL ),
145148 reason = "WFS service is unreachable" )
146149def test_schema_wfs_100 ():
147- wfs = WebFeatureService (
148- 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
149- version = '1.0.0' )
150- schema = wfs .get_schema ('footprint' )
151- assert len (schema ['properties' ]) == 4
152- assert schema ['properties' ]['summary' ] == 'string'
153- assert schema ['geometry' ] == 'Polygon'
150+ wfs = WebFeatureService (SERVICE_URL , version = '1.0.0' )
151+ schema = wfs .get_schema ('stratunit:StratigraphicUnit' )
152+ assert len (schema ['properties' ]) == 33
153+ assert schema ['properties' ]['DESCRIPTION' ] == 'string'
154+ assert schema ['geometry' ] is None
154155
155156
156- @pytest .mark .xfail
157157@pytest .mark .online
158158@pytest .mark .skipif (not service_ok (SERVICE_URL ),
159159 reason = "WFS service is unreachable" )
160160def test_schema_wfs_110 ():
161- wfs = WebFeatureService (
162- 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
163- version = '1.1.0' )
164- schema = wfs .get_schema ('footprint' )
165- assert len (schema ['properties' ]) == 4
166- assert schema ['properties' ]['summary' ] == 'string'
167- assert schema ['geometry' ] == '3D Polygon'
161+ wfs = WebFeatureService (SERVICE_URL , version = '1.1.0' )
162+ schema = wfs .get_schema ('stratunit:StratigraphicUnit' )
163+ assert len (schema ['properties' ]) == 33
164+ assert schema ['properties' ]['DESCRIPTION' ] == 'string'
165+ assert schema ['geometry' ] is None
168166
169167
170- @pytest .mark .xfail
171168@pytest .mark .online
172169@pytest .mark .skipif (not service_ok (SERVICE_URL ),
173170 reason = "WFS service is unreachable" )
174171def test_schema_wfs_200 ():
175- wfs = WebFeatureService (
176- 'https://www.sciencebase.gov/catalogMaps/mapping/ows/53398e51e4b0db25ad10d288' ,
177- version = '2.0.0' )
178- schema = wfs .get_schema ('footprint' )
179- assert len (schema ['properties' ]) == 4
180- assert schema ['properties' ]['summary' ] == 'string'
181- assert schema ['geometry' ] == '3D Polygon'
172+ wfs = WebFeatureService (SERVICE_URL , version = '2.0.0' )
173+ schema = wfs .get_schema ('stratunit:StratigraphicUnit' )
174+ assert len (schema ['properties' ]) == 33
175+ assert schema ['properties' ]['DESCRIPTION' ] == 'string'
176+ assert schema ['geometry' ] is None
182177
183178
184179@pytest .mark .online
185180@pytest .mark .skipif (not service_ok (SERVICE_URL ),
186181 reason = "WFS service is unreachable" )
187182def test_xmlfilter_wfs_110 ():
188- wfs = WebFeatureService (
189- 'https://services.ga.gov.au/gis/stratunits/ows' ,
190- version = '1.1.0' )
183+ wfs = WebFeatureService (SERVICE_URL , version = '1.1.0' )
191184 filter_prop = PropertyIsLike (propertyname = 'stratunit:GEOLOGICHISTORY' , literal = 'Cisuralian - Guadalupian' ,
192185 matchCase = True )
193186
@@ -203,9 +196,7 @@ def test_xmlfilter_wfs_110():
203196@pytest .mark .skipif (not service_ok (SERVICE_URL ),
204197 reason = "WFS service is unreachable" )
205198def test_xmlfilter_wfs_200 ():
206- wfs = WebFeatureService (
207- 'https://services.ga.gov.au/gis/stratunits/ows' ,
208- version = '2.0.0' )
199+ wfs = WebFeatureService (SERVICE_URL , version = '2.0.0' )
209200 filter_prop = PropertyIsLike (propertyname = 'stratunit:geologichistory' , literal = 'Cisuralian - Guadalupian' ,
210201 matchCase = True )
211202
0 commit comments