#NEWLINE# def test_list_all_pages( self ) : #NEWLINE# #INDENT# "Establish that the Resource class' `list` method correctly\n        accepts the --all-pages flag and checks follow-up pages.\n        " #NEWLINE# with client . test_mode as t : #NEWLINE# #INDENT# t . register_json ( '/foo/' , { #NEWLINE# #INDENT# 'count' : 3 , #NEWLINE# 'results' : [ { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'name' : 'foo' , #NEWLINE# 'description' : 'bar' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'next' : '/foo/?page=2' , #NEWLINE# 'previous' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# t . register_json ( '/foo/?page=2' , { #NEWLINE# #INDENT# 'count' : 3 , #NEWLINE# 'results' : [ { #NEWLINE# #INDENT# 'id' : 2 , #NEWLINE# 'name' : 'spam' , #NEWLINE# 'description' : 'eggs' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'next' : '/foo/?page=3' , #NEWLINE# 'previous' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# t . register_json ( '/foo/?page=3' , { #NEWLINE# #INDENT# 'count' : 3 , #NEWLINE# 'results' : [ { #NEWLINE# #INDENT# 'id' : 3 , #NEWLINE# 'name' : 'bacon' , #NEWLINE# 'description' : 'cheese' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'next' : None , #NEWLINE# 'previous' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# result = self . res . list ( all_pages = True ) #NEWLINE# self . assertEqual ( len ( t . requests ) , 3 ) #NEWLINE# self . assertEqual ( len ( result [ 'results' ] ) , 3 )