#NEWLINE# @ mock . patch . object ( utils , 'udevadm_settle' ) #NEWLINE# @ mock . patch . object ( pu , 'reread_partitions' ) #NEWLINE# @ mock . patch . object ( utils , 'execute' ) #NEWLINE# def test_set_partition_flag( self , mock_exec , mock_rerd , mock_udev ) : #NEWLINE# #INDENT# mock_exec . return_value = ( 'out' , '' ) #NEWLINE# pu . set_partition_flag ( '/dev/fake' , 1 , 'boot' ) #NEWLINE# mock_exec_expected_calls = [ mock . call ( 'parted' , '-s' , '/dev/fake' , 'set' , '1' , 'boot' , 'on' , check_exit_code = [ 0 , 1 ] ) ] #NEWLINE# mock_udev . assert_called_once_with ( ) #NEWLINE# self . assertEqual ( mock_exec_expected_calls , mock_exec . call_args_list ) #NEWLINE# mock_rerd . assert_called_once_with ( '/dev/fake' , out = 'out' ) #NEWLINE# mock_exec . reset_mock ( ) #NEWLINE# mock_rerd . reset_mock ( ) #NEWLINE# mock_udev . reset_mock ( ) #NEWLINE# pu . set_partition_flag ( '/dev/fake' , 1 , 'boot' , state = 'off' ) #NEWLINE# mock_exec_expected_calls = [ mock . call ( 'parted' , '-s' , '/dev/fake' , 'set' , '1' , 'boot' , 'off' , check_exit_code = [ 0 , 1 ] ) ] #NEWLINE# mock_udev . assert_called_once_with ( ) #NEWLINE# self . assertEqual ( mock_exec_expected_calls , mock_exec . call_args_list ) #NEWLINE# mock_rerd . assert_called_once_with ( '/dev/fake' , out = 'out' )