#NEWLINE# @ mock . patch . object ( time , 'sleep' , autospec = True ) #NEWLINE# def test_power_reset_delay_option( self , mock_sleep , mock_get_client ) : #NEWLINE# #INDENT# self . config ( reboot_delay = 5 , group = 'snmp' ) #NEWLINE# mock_client = mock_get_client . return_value #NEWLINE# driver = snmp . _get_driver ( self . node ) #NEWLINE# mock_client . get . side_effect = [ driver . value_power_off , driver . value_power_on ] #NEWLINE# pstate = driver . power_reset ( ) #NEWLINE# calls = [ mock . call ( driver . _snmp_oid ( ) , driver . value_power_off ) , mock . call ( driver . _snmp_oid ( ) , mock_client . value_power_on ) ] #NEWLINE# mock_client . set . assert_has_calls ( calls ) #NEWLINE# calls = ( [ mock . call ( driver . _snmp_oid ( ) ) ] * 2 ) #NEWLINE# mock_client . get . assert_has_calls ( calls ) #NEWLINE# self . assertEqual ( states . POWER_ON , pstate ) #NEWLINE# mock_sleep . assert_called_once_with ( 5 )