#NEWLINE# def testExecuteBinariesWithArgs( self ) : #NEWLINE# #INDENT# client_mock = action_mocks . ActionMock ( 'ExecuteBinaryCommand' ) #NEWLINE# code = 'I am a binary file' #NEWLINE# upload_path = config_lib . CONFIG [ 'Executables.aff4_path' ] . Add ( 'test.exe' ) #NEWLINE# maintenance_utils . UploadSignedConfigBlob ( code , aff4_path = upload_path , token = self . token ) #NEWLINE# user = aff4 . FACTORY . Create ( ( 'aff4:/users/%s' % self . token . username ) , mode = 'rw' , aff4_type = 'GRRUser' , token = self . token ) #NEWLINE# user . SetLabels ( 'admin' , owner = 'GRR' ) #NEWLINE# user . Close ( ) #NEWLINE# with utils . Stubber ( subprocess , 'Popen' , test_lib . Popen ) : #NEWLINE# #INDENT# for _ in test_lib . TestFlowHelper ( 'LaunchBinary' , client_mock , client_id = self . client_id , binary = upload_path , command_line = '--value 356' , token = self . token ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . assertEqual ( test_lib . Popen . binary , user ) #NEWLINE# self . assertRaises ( IOError , open , test_lib . Popen . running_args [ 0 ] ) #NEWLINE# self . assertEqual ( test_lib . Popen . running_args [ 1 ] , '--value' ) #NEWLINE# self . assertEqual ( test_lib . Popen . running_args [ 2 ] , '356' ) #NEWLINE# self . assertTrue ( test_lib . Popen . running_args [ 0 ] . startswith ( config_lib . CONFIG [ 'Client.tempdir_roots' ] [ 0 ] ) )