#NEWLINE# def testRouteSystem( self ) : #NEWLINE# #INDENT# dummy = DummyResource ( ) #NEWLINE# exc = None #NEWLINE# try : #NEWLINE# #INDENT# dummy . handleRoute ( 'GET' , ( ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except RestException as e : #NEWLINE# #INDENT# exc = e . message #NEWLINE# #UNINDENT# self . assertEqual ( exc , 'No matching route for "GET "' ) #NEWLINE# r = dummy . handleRoute ( 'GET' , ( 'literal1' , 'foo' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( r , { #NEWLINE# #INDENT# 'wc1' : 'literal1' , #NEWLINE# 'wc2' : 'foo' , #NEWLINE# 'params' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# r = dummy . handleRoute ( 'GET' , ( 'literal1' , 'literal2' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( r , { #NEWLINE# #INDENT# 'params' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# r = dummy . handleRoute ( 'PATCH' , ( 'guid' , 'patchy' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( r , { #NEWLINE# #INDENT# 'id' : 'guid' , #NEWLINE# 'params' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# dummy . route ( 'DUMMY' , ( ':id' , 'dummy' ) , dummy . handler ) #NEWLINE# r = dummy . handleRoute ( 'DUMMY' , ( 'guid' , 'dummy' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( r , { #NEWLINE# #INDENT# 'id' : 'guid' , #NEWLINE# 'params' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# dummy . removeRoute ( 'DUMMY' , ( ':id' , 'dummy' ) , dummy . handler ) #NEWLINE# self . assertRaises ( RestException , dummy . handleRoute , 'DUMMY' , ( 'guid' , 'dummy' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } )