def test_echo_command_custom_prefix(self): mock_stream = MagicMock() shell._echo_command('ls', mock_stream, prefix='$ ') mock_stream.write.assert_called_with('$ ls\n') assert (mock_stream.flush.called)
def test_echo_command(self): test_command = ['sudo', 'rm', '-rf', '/tmp/*'] mock_stream = MagicMock() shell._echo_command(test_command, mock_stream) mock_stream.write.assert_called_with('>>> {}\n'.format( shell.quote(test_command))) assert (mock_stream.flush.called)