Ignore:
Timestamp:
21/06/10 10:47:25 (10 years ago)
Author:
pjkersha
Message:

Incomplete - task 9: Data Browser Replacement

  • added support for client byte range requests via the the HTTP Range header field - tested in unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ceda_http_fileserver/trunk/ceda_http_fileserver/ceda/server/wsgi/fileserver/test/test_fileserver.py

    r7032 r7038  
    6565    def __init__(self, *args, **kwargs): 
    6666        self.fileServerApp = FileServerApp(self.__class__.HTDOCS_DIR) 
     67         
     68        # Small block size to test WSGI iterator for writing response 
     69        self.fileServerApp.writeBlkSize = 256 
    6770        self.app = paste.fixture.TestApp(self.fileServerApp) 
    6871          
     
    157160         
    158161    def test11AccessForbidden(self): 
    159          
     162        # Set a file on the file system with permissions so that it can be read 
     163        # and ensure that the server returns a 403 Forbidden response for a  
     164        # request for this file 
    160165        jpegFilePath = path.join(self.__class__.HTDOCS_DIR, 
    161166                                 self.__class__.JPEG_REL_FILEPATH) 
     
    215220                                status=httplib.PARTIAL_CONTENT) 
    216221        self.assert_('content-range' in response.header_dict) 
    217          
     222        print('Content-range: %s' % response.header_dict['content-range']) 
     223        self.assert_(len(response.body) == 600) 
     224         
     225    def test15CatchInvalidRangeSyntax(self): 
     226        # Specify invalid range syntax 
     227        headers = {'Range': 'a bad range'} 
     228        response = self.app.get(self.__class__.PDF_REL_URIPATH, 
     229                                headers=headers,  
     230                                status=httplib.BAD_REQUEST) 
     231         
     232    def test15CatchInvalidRange(self): 
     233        # Specify a range of bytes for retrieval 
     234        headers = {'Range': '100-99999999999999999'} 
     235        response = self.app.get(self.__class__.PDF_REL_URIPATH, 
     236                                headers=headers,  
     237                                status=httplib.REQUESTED_RANGE_NOT_SATISFIABLE) 
     238        self.assert_('content-range' in response.header_dict)     
     239        print('Content-range: %s' % response.header_dict['content-range']) 
     240         
     241               
    218242class FileServerAppPasterTestCase(FileServerAppTestCaseBase):   
    219243    """Base class for common Paste Deploy related set-up""" 
Note: See TracChangeset for help on using the changeset viewer.