#NEWLINE# def test_index_json( self ) : #NEWLINE# #INDENT# index = webtest . TestApp ( router . Index ( { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# res = index . get ( '' ) #NEWLINE# self . assertIn ( 'resources' , res . json ) #NEWLINE# self . assertEqual ( 1 , len ( res . json [ 'resources' ] ) ) #NEWLINE# resource = res . json [ 'resources' ] [ 0 ] #NEWLINE# self . assertIn ( 'collection' , resource ) #NEWLINE# self . assertEqual ( 'bar' , resource [ 'collection' ] ) #NEWLINE# self . assertIn ( 'name' , resource ) #NEWLINE# self . assertEqual ( 'foo' , resource [ 'name' ] ) #NEWLINE# self . assertIn ( 'links' , resource ) #NEWLINE# self . assertEqual ( 1 , len ( resource [ 'links' ] ) ) #NEWLINE# link = resource [ 'links' ] [ 0 ] #NEWLINE# self . assertIn ( 'href' , link ) #NEWLINE# self . assertEqual ( link [ 'href' ] , 'http://localhost/bar' ) #NEWLINE# self . assertIn ( 'rel' , resource ) #NEWLINE# self . assertEqual ( 'self' , link [ 'rel' ] )