Changeset 4182 for TI05-delivery


Ignore:
Timestamp:
08/09/08 10:07:08 (11 years ago)
Author:
cbyrom
Message:

Extend controller level test suite.

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/functional
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/functional/test_fetch.py

    r2740 r4182  
     1""" 
     2Test cases for the ows fetch controller 
     3 
     4NERC Data Grid Project 
     5""" 
     6__author__ = "C Byrom - Tessella" 
     7__date__ = "03/09/08" 
     8__copyright__ = "(C) 2008 STFC & NERC" 
     9__license__ = \ 
     10"""This software may be distributed under the terms of the Q Public  
     11License, version 1.0 or later.""" 
     12__contact__ = "b.n.lawrence@rl.ac.uk" 
     13__revision__ = '$Id: $' 
     14 
    115from ows_server.tests import * 
     16import logging 
     17 
     18logging.basicConfig(level=logging.DEBUG, 
     19                        format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s') 
    220 
    321class TestFetchController(TestController): 
    4     def test_index(self): 
    5         response = self.app.get(url_for(controller='fetch')) 
    6         # Test response... 
     22    def testFetchFileSecurityOn(self): 
     23        response = self.app.get(url_for(controller='fetch', \ 
     24                                        file='testSecurityOn', action='fetchFile')) 
     25        self.assertEqual(response.status, 200) 
     26 
     27    def testFetchFileSecurityOff(self): 
     28        response = self.app.get(url_for(controller='fetch', \ 
     29                                        file='testSecurityOff', action='fetchFile')) 
     30        self.assertEqual(response.status, 200) 
     31         
     32    def testInvalidFetchFile(self): 
     33        try: 
     34            response = self.app.get(url_for(controller='fetch', \ 
     35                                            file='blah', action='fetchFile')) 
     36            self.fail("An exception should have been thrown") 
     37        except IOError, e: 
     38            pass 
     39        except Exception, e: 
     40            self.fail("An IOError should have been thrown") 
     41             
     42         
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/tests/functional/test_retrieve.py

    r2615 r4182  
     1""" 
     2Test cases for the ows retrieve controller 
     3 
     4NERC Data Grid Project 
     5""" 
     6__author__ = "C Byrom - Tessella" 
     7__date__ = "03/09/08" 
     8__copyright__ = "(C) 2008 STFC & NERC" 
     9__license__ = \ 
     10"""This software may be distributed under the terms of the Q Public  
     11License, version 1.0 or later.""" 
     12__contact__ = "b.n.lawrence@rl.ac.uk" 
     13__revision__ = '$Id: $' 
     14 
    115from ows_server.tests import * 
     16import logging 
     17 
     18logging.basicConfig(level=logging.DEBUG, 
     19                        format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s') 
    220 
    321class TestRetrieveController(TestController): 
    4     def test_index(self): 
    5         response = self.app.get(url_for(controller='retrieve',uri='blah')) 
    6         # Test response... 
    7         assert 'not a valid' in response 
     22    def testInvalidURIIndex(self): 
     23        try: 
     24            response = self.app.get(url_for(controller='retrieve', uri='blah')) 
     25            self.fail('An exception should have been thrown here') 
     26        except Exception, e: 
     27            print e 
     28            print type(e) 
     29            assert 'not a valid' in e.message 
     30 
     31 
     32    def testValidDEURIIndex(self): 
     33        try: 
     34            response = self.app.get(url_for(controller='retrieve',uri='badc.nerc.ac.uk__DIF__dataent_ERBE')) 
     35            self.assertEqual(response.status, 200) 
     36        except Exception, e: 
     37            print e 
     38            print type(e) 
     39            self.fail('An exception should not have been thrown here') 
     40 
     41 
     42    def testValidNDGB1URIIndex(self): 
     43        try: 
     44            response = self.app.get(url_for(controller='retrieve',uri='badc.nerc.ac.uk__NDG-B1__dataent_ERBE')) 
     45            self.assertEqual(response.status, 200) 
     46        except Exception, e: 
     47            print e 
     48            print type(e) 
     49            self.fail('An exception should not have been thrown here') 
     50 
     51 
     52    def testValidAtomURIIndex(self): 
     53        try: 
     54            response = self.app.get(url_for(controller='retrieve',uri='badc.nerc.ac.uk__ATOM__dataent_11679938403412067')) 
     55            self.assertEqual(response.status, 200) 
     56        except Exception, e: 
     57            print e 
     58            print type(e) 
     59            self.fail('An exception should not have been thrown here') 
     60 
     61    def testValidDEURIView(self): 
     62        try: 
     63            response = self.app.get(url_for(controller='retrieve', action='view', uri='badc.nerc.ac.uk__DIF__dataent_ERBE')) 
     64            self.assertEqual(response.status, 200) 
     65        except Exception, e: 
     66            print e 
     67            print type(e) 
     68            self.fail('An exception should not have been thrown here') 
Note: See TracChangeset for help on using the changeset viewer.