#NEWLINE# @ mock . patch ( 'eventlet.greenthread.sleep' , autospec = True ) #NEWLINE# def test_power_off_delay( self , mock_sleep , mock_get_client ) : #NEWLINE# #INDENT# mock_client = mock_get_client . return_value #NEWLINE# driver = snmp . _get_driver ( mock_get_client . node ) #NEWLINE# mock_client . get . side_effect = [ driver . value_power_on , driver . value_power_off ] #NEWLINE# pstate = driver . power_off ( ) #NEWLINE# mock_client . set . assert_called_once_with ( driver . _snmp_oid ( ) , driver . value_power_off ) #NEWLINE# calls = ( [ mock . call ( driver . _snmp_oid ( ) ) ] * 2 ) #NEWLINE# mock_client . get . assert_has_calls ( calls ) #NEWLINE# self . assertEqual ( states . POWER_OFF , pstate )