#NEWLINE# def testIteration( self ) : #NEWLINE# #INDENT# '.' #NEWLINE# mock_query = self . mox . CreateMockAnything ( ) #NEWLINE# step = 2 #NEWLINE# first_iteration = [ 1 , 2 ] #NEWLINE# second_iteration = [ 3 , 4 ] #NEWLINE# entities = ( first_iteration + second_iteration ) #NEWLINE# mock_query . fetch ( step ) . AndReturn ( second_iteration ) #NEWLINE# mock_query . cursor ( ) . AndReturn ( 'cursor1' ) #NEWLINE# mock_query . with_cursor ( 'cursor1' ) #NEWLINE# mock_query . fetch ( step ) . AndReturn ( second_iteration ) #NEWLINE# mock_query . cursor ( ) . AndReturn ( 'cursor2' ) #NEWLINE# mock_query . with_cursor ( 'cursor2' ) #NEWLINE# mock_query . fetch ( step ) . AndReturn ( [ ] ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# out = [ ] #NEWLINE# for entity in gae_util . QueryIterator ( mock_query , step = step ) : #NEWLINE# #INDENT# out . append ( entity ) #NEWLINE# #UNINDENT# self . assertEqual ( out , entities ) #NEWLINE# self . mox . VerifyAll ( )