def test_run_command_in_vagrant_wraps_ssh_call(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.wrap_ssh_call.assert_called_once_with( self.vagrant_ssh_config, ssh_user=HYPERNODE_VAGRANT_DEFAULT_USER, command_to_run='bash runtests.sh')
def test_run_command_in_vagrant_runs_local_command(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.check_call.assert_called_once_with( self.wrap_ssh_call.return_value, shell=True, stdout=stdout, bufsize=1)
def test_run_command_in_vagrant_wraps_ssh_call(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.wrap_ssh_call.assert_called_once_with( self.vagrant_ssh_config, ssh_user=HYPERNODE_VAGRANT_DEFAULT_USER, command_to_run='bash runtests.sh' )
def test_run_command_in_vagrant_wraps_ssh_call_as_specified_user(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config, ssh_user='******') self.wrap_ssh_call.assert_called_once_with( self.vagrant_ssh_config, ssh_user='******', command_to_run='bash runtests.sh')
def test_run_command_writes_error_output_to_stdout_if_error(self): self.output = Mock() self.run_local_command.side_effect = CalledProcessError( 1, 'bash runtests.sh', output=self.output) run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.write_output_to_stdout.assert_called_once_with(self.output)
def test_run_command_in_vagrant_wraps_ssh_call_as_specified_user(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config, ssh_user='******') self.wrap_ssh_call.assert_called_once_with( self.vagrant_ssh_config, ssh_user='******', command_to_run='bash runtests.sh' )
def test_run_command_writes_error_output_to_stdout_if_error(self): self.output = Mock() self.run_local_command.side_effect = CalledProcessError( 1, 'bash runtests.sh', output=self.output ) run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.write_output_to_stdout.assert_called_once_with(self.output)
def test_run_command_does_not_write_error_output_to_stdout_if_no_error( self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.assertFalse(self.write_output_to_stdout.called)
def test_run_command_in_vagrant_runs_local_command(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.run_local_command.assert_called_once_with( self.wrap_ssh_call.return_value, shell=True)
def test_run_command_does_not_write_error_output_to_stdout_if_no_error(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.assertFalse(self.write_output_to_stdout.called)
def test_run_command_in_vagrant_runs_local_command(self): run_command_in_vagrant('bash runtests.sh', self.vagrant_ssh_config) self.run_local_command.assert_called_once_with( self.wrap_ssh_call.return_value, shell=True )