#NEWLINE# def testCustomWebRoot( self ) : #NEWLINE# #INDENT# '\n        Tests the ability of plugins to serve their own custom server roots.\n        ' #NEWLINE# resp = self . request ( '/' , prefix = '' , isJson = False ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertEqual ( self . getBody ( resp ) , 'hello world' ) #NEWLINE# resp = self . request ( '/girder' , prefix = '' , isJson = False ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertTrue ( ( 'g-global-info-apiroot' in self . getBody ( resp ) ) ) #NEWLINE# resp = self . request ( '/api/v1' , prefix = '' , isJson = False ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertTrue ( ( 'Girder REST API Documentation' in self . getBody ( resp ) ) ) #NEWLINE# resp = self . request ( '/api' , prefix = '' , isJson = False ) #NEWLINE# self . assertStatus ( resp , 303 ) #NEWLINE# self . assertTrue ( ( '/api/v1' in self . getBody ( resp ) ) ) #NEWLINE# resp = self . request ( '/describe' ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertTrue ( ( 'apis' in resp . json ) ) #NEWLINE# otherDocs = [ x for x in resp . json [ 'apis' ] if ( x [ 'path' ] == '/other' ) ] #NEWLINE# self . assertEqual ( len ( otherDocs ) , 1 ) #NEWLINE# resp = self . request ( '/describe/other' ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertEqual ( len ( resp . json [ 'apis' ] ) , 1 ) #NEWLINE# resp = self . request ( '/other' ) #NEWLINE# self . assertStatusOk ( resp ) #NEWLINE# self . assertEqual ( resp . json , [ 'custom REST route' ] ) #NEWLINE# resp = self . request ( '/girder/api/v1' , prefix = '' , isJson = False ) #NEWLINE# self . assertStatus ( resp , 404 ) #NEWLINE# resp = self . request ( '/static_route' , prefix = '' , isJson = False ) #NEWLINE# self . assertEqual ( self . getBody ( resp ) , 'Hello world!\n' )