source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/test_models.py @ 2488

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/test_models.py@2488
Revision 2488, 883 bytes checked in by spascoe, 12 years ago (diff)

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

Line 
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 TracBrowser for help on using the repository browser.