#NEWLINE# def test_link_pagination( schema , session ) : #NEWLINE# #INDENT# def response_callback( request , context ) : #NEWLINE# #INDENT# assert ( request . method == 'GET' ) #NEWLINE# context . status_code = 206 #NEWLINE# context . headers [ 'content-type' ] = 'application/json' #NEWLINE# FAKE_RANGE = ']fake..' #NEWLINE# if ( 'Range' in request . headers ) : #NEWLINE# #INDENT# assert ( request . headers [ 'Range' ] == FAKE_RANGE ) #NEWLINE# return [ { #NEWLINE# #INDENT# 'name' : 'app3' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'app4' , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# context . headers [ 'next-range' ] = FAKE_RANGE #NEWLINE# return [ { #NEWLINE# #INDENT# 'name' : 'app1' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'app2' , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# #UNINDENT# session . requests_mock . register_uri ( 'GET' , 'https://api.heroku.com/apps' , json = session ) #NEWLINE# service = Service ( schema , session ) #NEWLINE# apps = service . app . list ( ) #NEWLINE# assert ( [ a . name for a in apps ] == [ 'app1' , 'app2' , 'app3' , 'app4' ] )