#NEWLINE# @ mock . patch . object ( push . Screen , 'getWaitingConnections' ) #NEWLINE# def test_quitPage( self , mock_getWaitingConnections ) : #NEWLINE# #INDENT# 'This tests the quitPage method of Screen class.' #NEWLINE# waiting_connections = [ ] #NEWLINE# device_len = random . randint ( 1 , 20 ) #NEWLINE# device_names = [ ] #NEWLINE# configlet = mock . MagicMock ( ) #NEWLINE# configlet . device = mock . MagicMock ( ) #NEWLINE# for i in range ( device_len ) : #NEWLINE# #INDENT# configlet . device . name = ( 'configlet' + str ( i ) ) #NEWLINE# device_names . append ( configlet . device . name ) #NEWLINE# curr_configlet = copy . deepcopy ( configlet ) #NEWLINE# waiting_connections . append ( curr_configlet ) #NEWLINE# #UNINDENT# mock_getWaitingConnections . return_value = waiting_connections #NEWLINE# lines = self . screen . quitPage ( ) #NEWLINE# lines = lines [ 3 : ( device_len + 3 ) ] #NEWLINE# self . assertEqual ( lines , device_names )