source: TI02-CSML/trunk/services/3rdParty/OWSLib-0.2.0/tests/MapServerWFSCapabilities.txt @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/OWSLib-0.2.0/tests/MapServerWFSCapabilities.txt@2194
Revision 2194, 3.2 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

Line 
1
2Imports
3
4    >>> from owslib.wfs import WebFeatureService
5   
6Fake a request to a WFS Server using saved doc from.
7
8    >>> xml = open('mapserver-wfs-cap.xml', 'r').read()
9    >>> wfs = WebFeatureService('url', version='1.0', xml=xml)
10   
11Test capabilities
12
13    >>> wfs.capabilities.service
14    'MapServer WFS'
15
16    >>> wfs.capabilities.title
17    'Bird Studies Canada WMS/WFS Server'
18   
19    >>> wfs.capabilities.abstract
20    'Bird Studies Canada WMS/WFS Server for bird distribution and abundance data, and related information.  Bird Studies Canada gratefully acknowledges the support of Environment Canada - Canadian Information System for the Environment in developing this service.'
21   
22    >>> wfs.capabilities.link
23    'http://geodiscover.cgdi.ca/gdp/search?action=entrySummary&entryType=webService&entryId=3920&entryLang=en&portal=gdp'
24   
25    >>> wfs.capabilities.keywords
26    []
27   
28    >>> p = wfs.capabilities.provider
29    >>> p.name
30   
31    >>> p.email
32   
33   
34Test available content layers
35
36    >>> [layer.name for layer in wfs.capabilities.contents]
37    ['IBA', 'CBC_PT', 'CBC_PY', 'MMP', 'CLLS', 'OBBA_SQUARE', 'OBBA_REGION', 'OBBA_BLOCK', 'OWLS', 'BBS_PT']
38   
39    >>> [layer.title for layer in wfs.capabilities.contents]
40    ['Canadian Important Bird Areas', 'Canadian Christmas Bird Count Locations', 'Canadian Christmas Bird Count Locations', 'Marsh Monitoring Program Route Locations', 'Canadian Lakes Loon Survey Locations', 'Ontario Breeding Bird Atlas 10 km Squares', 'Ontario Breeding Bird Atlas Administrative Regions', 'Ontario Breeding Bird Atlas 100 km Blocks', 'Nocturnal Owl Survey Locations', 'Breeding Bird Survey Route Start Points']
41   
42Test single item accessor
43
44    >>> wfs.capabilities.getContentByName('IBA').title
45    'Canadian Important Bird Areas'
46   
47    >>> wfs.capabilities.getContentByName('IBA').boundingBox
48   
49    >>> wfs.capabilities.getContentByName('IBA').boundingBoxWGS84
50    (-141.238, 41.671799999999998, -52.667000000000002, 78.105900000000005)
51   
52    >>> wfs.capabilities.getContentByName('IBA').crsOptions
53    ['EPSG:4326']
54   
55    >>> wfs.capabilities.getContentByName('IBA').verbOptions
56    ['{http://www.opengis.net/wfs}Query']
57   
58Expect a KeyError for invalid names
59
60    >>> wfs.capabilities.getContentByName('utterly bogus').title
61    Traceback (most recent call last):
62    ...
63    KeyError: 'No content named utterly bogus'
64
65Test operations
66
67    >>> [op.name for op in wfs.capabilities.operations]
68    ['{http://www.opengis.net/wfs}GetCapabilities', '{http://www.opengis.net/wfs}DescribeFeatureType', '{http://www.opengis.net/wfs}GetFeature']
69   
70    >>> wfs.capabilities.getOperationByName('{http://www.opengis.net/wfs}GetFeature').methods
71    {'{http://www.opengis.net/wfs}Get': {'url': 'http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?'}, '{http://www.opengis.net/wfs}Post': {'url': 'http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?'}}
72   
73    >>> wfs.capabilities.getOperationByName('{http://www.opengis.net/wfs}GetFeature').formatOptions
74    ['{http://www.opengis.net/wfs}GML2', '{http://www.opengis.net/wfs}GML3']
75
76Lastly, test the getcapabilities method
77
78    >>> wfs = WebFeatureService('http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?', version='1.0')
79    >>> xml = wfs.getcapabilities().read()
80    >>> xml.find('<WFS_Capabilities') > 0
81    True
82
Note: See TracBrowser for help on using the repository browser.