def test_ows_interfaces_wms(): wmsxml = open(resource_file('wms_JPLCapabilities.xml'), 'rb').read() service = WebMapService('url', version='1.1.1', xml=wmsxml) # Check each service instance conforms to OWSLib interface service.alias = 'WMS' isinstance(service, owslib.map.wms111.WebMapService_1_1_1) # URL attribute assert service.url == 'url' # version attribute assert service.version == '1.1.1' # Identification object assert hasattr(service, 'identification') # Check all ServiceIdentification attributes assert service.identification.type == 'OGC:WMS' for attribute in ['type', 'version', 'title', 'abstract', 'keywords', 'accessconstraints', 'fees']: assert hasattr(service.identification, attribute) # Check all ServiceProvider attributes for attribute in ['name', 'url', 'contact']: assert hasattr(service.provider, attribute) # Check all operations implement IOperationMetadata for op in service.operations: for attribute in ['name', 'formatOptions', 'methods']: assert hasattr(op, attribute) # Check all contents implement IContentMetadata as a dictionary isinstance(service.contents, OrderedDict) # Check any item (WCS coverage, WMS layer etc) from the contents of each service # Check it conforms to IContentMetadata interface # get random item from contents dictionary -has to be a nicer way to do this! content = service.contents[list(service.contents.keys())[0]] for attribute in ['id', 'title', 'boundingBox', 'boundingBoxWGS84', 'crsOptions', 'styles', 'timepositions']: assert hasattr(content, attribute)