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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/OWSLib-0.2.0/tests/TelaCapabilities.txt@2194
Revision 2194, 2.6 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.wms import WebMapService
5   
6Fake a request to a WMS Server using saved doc from telascience.org.
7http://wms.telascience.org/cgi-bin/ngBM_wms?
8
9    >>> xml = open('Telascience.xml', 'r').read()
10    >>> wms = WebMapService('url', version='1.1.1', xml=xml)
11   
12Test capabilities
13
14    >>> wms.capabilities.service
15    'OGC:WMS'
16
17    >>> wms.capabilities.title
18    'BM'
19
20    >>> wms.capabilities.abstract
21    'Blue Marble 200409'
22   
23    >>> wms.capabilities.link
24    'http://wms.telascience.org/cgi-bin/ngBM_wms?'
25   
26    >>> wms.capabilities.keywords
27    []
28
29    >>> p = wms.capabilities.provider
30    >>> p.name
31    'Norman Vine'
32    >>> p.email
33    'nhv@cooa.whoi.edu'
34
35Test available content layers
36
37    >>> [layer.name for layer in wms.capabilities.contents]
38    ['world.topo.bathy.200409', 'USGS_1ft_San_Diego']
39   
40    >>> [layer.title for layer in wms.capabilities.contents]
41    ['world.topo.bathy.200409', 'USGS 1ft San Diego']
42   
43Test single item accessor
44
45    >>> wms.capabilities.getContentByName('world.topo.bathy.200409').title
46    'world.topo.bathy.200409'
47   
48    >>> wms.capabilities.getContentByName('world.topo.bathy.200409').boundingBox
49    (-180.0, -90.0, 180.0, 90.0, 'EPSG:4326')
50   
51    >>> wms.capabilities.getContentByName('world.topo.bathy.200409').boundingBoxWGS84
52    (-180.0, -90.0, 180.0, 90.0)
53   
54    >>> wms.capabilities.getContentByName('world.topo.bathy.200409').crsOptions
55    ['EPSG:4326']
56   
57    >>> wms.capabilities.getContentByName('world.topo.bathy.200409').styles
58    {}
59   
60Expect a KeyError for invalid names
61
62    >>> wms.capabilities.getContentByName('utterly bogus').title
63    Traceback (most recent call last):
64    ...
65    KeyError: 'No content named utterly bogus'
66
67Test operations
68
69    >>> [op.name for op in wms.capabilities.operations]
70    ['GetCapabilities', 'GetMap', 'GetFeatureInfo', 'DescribeLayer', 'GetLegendGraphic']
71   
72    >>> wms.capabilities.getOperationByName('GetMap').methods
73    {'Post': {'url': 'http://wms.telascience.org/cgi-bin/ngBM_wms?'}, 'Get': {'url': 'http://wms.telascience.org/cgi-bin/ngBM_wms?'}}
74   
75    >>> wms.capabilities.getOperationByName('GetMap').formatOptions
76    ['image/gif', 'image/png', 'image/jpeg', 'image/wbmp', 'image/tiff', 'image/png; mode=24bit']
77
78Test exceptions
79
80    >>> wms.capabilities.exceptions
81    ['application/vnd.ogc.se_xml', 'application/vnd.ogc.se_inimage', 'application/vnd.ogc.se_blank']
82
83Lastly, test the getcapabilities method
84
85    >>> wms = WebMapService('http://wms.telascience.org/cgi-bin/ngBM_wms?', version='1.1.1')
86    >>> xml = wms.getcapabilities().read()
87    >>> xml.find('<WMT_MS_Capabilities version="1.1.1">') > 0
88    True
89
Note: See TracBrowser for help on using the repository browser.