Changeset 2488 for TI05-delivery


Ignore:
Timestamp:
17/05/07 11:49:21 (12 years ago)
Author:
spascoe
Message:

Moved wms_capabilities test cases to the correct place. Implemented
several tests using an OGC example document.

Location:
TI05-delivery/ows_framework/trunk/ows_server
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server.egg-info/PKG-INFO

    r2484 r2488  
    11Metadata-Version: 1.0 
    22Name: ows-server 
    3 Version: 0.0.0dev-r2479 
     3Version: 0.0.0dev-r2486 
    44Summary: UNKNOWN 
    55Home-page: UNKNOWN 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server.egg-info/SOURCES.txt

    r2484 r2488  
    3131ows_server/lib/base.py 
    3232ows_server/lib/helpers.py 
     33ows_server/lib/wms_capabilities.py 
    3334ows_server/models/__init__.py 
    3435ows_server/public/index.html 
     
    3637ows_server/templates/autohandler 
    3738ows_server/templates/exception_report.kid 
     39ows_server/templates/wms_service_metadata.kid 
    3840ows_server/tests/__init__.py 
    3941ows_server/tests/test_models.py 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/wms_capabilities.py

    r2486 r2488  
    1111# Namespaces 
    1212ows_ns = 'http://www.opengis.net/ows/1.1' 
     13xlink_ns = 'http://www.w3.org/1999/xlink' 
    1314 
    1415# ElementTree utilities 
     
    4344    abstracts = property(_getAbstracts) 
    4445 
    45 #----------------------------------------------------------------------------- 
     46    def _getKeywords(self): 
     47        es = self.ows_tree.findall(ows_path(['ServiceIdentification', 
     48                                             'Keywords', 
     49                                             'Keyword'])) 
     50        return [x.text for x in es] 
     51    keywords = property(_getKeywords) 
    4652 
    47 from unittest import TestCase 
    48 import pkg_resources 
    49  
    50 class TestWmsCapabilities(TestCase): 
    51     def setUp(self): 
    52         fh = pkg_resources.resource_stream('ows_server.lib.tests', 
    53                                            'exampleCapabilities1.xml') 
    54         self.woa = WmsOwsAdapter(ET.parse(fh)) 
    55  
    56     def testTitle(self): 
    57         assert self.woa.title == 'Acme Corp. Map Server' 
    58  
    59     def testAbstract(self): 
    60         assert False 
     53    def _getOnlineResource(self): 
     54        e = self.ows_tree.find(ows_path(['ServiceProvider', 
     55                                         'ProviderSite'])) 
     56        if e is not None: 
     57            return e.attrib[qname(xlink_ns, 'href')] 
     58        else: 
     59            return None 
     60    onlineResource = property(_getOnlineResource) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/test_models.py

    r2476 r2488  
     1from unittest import TestCase 
     2import pkg_resources 
     3 
     4from elementtree import ElementTree as ET 
     5from ows_server.lib.wms_capabilities import WmsOwsAdapter 
     6 
     7class TestWmsCapabilities(TestCase): 
     8    def setUp(self): 
     9        fh = pkg_resources.resource_stream('ows_server.tests', 
     10                                           'exampleCapabilities1.xml') 
     11        self.woa = WmsOwsAdapter(ET.parse(fh)) 
     12 
     13    def testTitle(self): 
     14        assert 'Acme Corp. Map Server' in self.woa.title 
     15 
     16    def testAbstract(self): 
     17        abstracts = self.woa.abstracts 
     18        assert len(abstracts) == 1 
     19        assert 'Contact: webmaster@wmt.acme.com' in abstracts[0] 
     20 
     21    def testKeywords(self): 
     22        keywords = self.woa.keywords 
     23        assert keywords == ['bird', 'roadrunner', 'ambush'] 
     24 
     25    def testOnlineResource(self): 
     26        olr = self.woa.onlineResource 
     27        assert olr == 'http://hostname/' 
Note: See TracChangeset for help on using the changeset viewer.