#NEWLINE# def test_multiple_links( client , url_name = 'post-list' ) : #NEWLINE# #INDENT# author = models . Person . objects . create ( name = 'test' ) #NEWLINE# post = models . Post . objects . create ( author = author , title = 'Test post title' ) #NEWLINE# models . Comment . objects . create ( post = post , body = 'Test comment one.' ) #NEWLINE# models . Comment . objects . create ( post = post , body = 'Test comment two.' ) #NEWLINE# results = { #NEWLINE# #INDENT# 'links' : { #NEWLINE# #INDENT# 'posts.author' : { #NEWLINE# #INDENT# 'href' : 'http://testserver/people/{posts.author}/' , #NEWLINE# 'type' : 'people' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'posts.comments' : { #NEWLINE# #INDENT# 'href' : 'http://testserver/comments/{posts.comments}/' , #NEWLINE# 'type' : 'comments' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'posts' : [ { #NEWLINE# #INDENT# 'id' : '1' , #NEWLINE# 'title' : 'Test post title' , #NEWLINE# 'href' : 'http://testserver/posts/1/' , #NEWLINE# 'links' : { #NEWLINE# #INDENT# 'author' : '1' , #NEWLINE# 'comments' : [ '1' , '2' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# response = client . get ( reverse ( url_name ) ) #NEWLINE# assert ( response . content == dump_json ( results ) )