# -*- coding: utf-8 -*-
"""
Testing of cut command.
"""

__author__ = '<NAME>'
__copyright__ = 'Copyright (C) 2019, Nokia'
__email__ = '<EMAIL>'

from moler.cmd.unix.cut import Cut
from moler.exceptions import CommandFailure
import pytest


def test_cut_raise_exception(buffer_connection, command_output_and_expected_result):
    command_output, expected_result = command_output_and_expected_result
    buffer_connection.remote_inject_response([command_output])
    cut_cmd = Cut(connection=buffer_connection.moler_connection)
    with pytest.raises(CommandFailure):
        cut_cmd()


@pytest.fixture
def command_output_and_expected_result():
    data = """host:~ # cut
cut: you must specify a list of bytes, characters, or fields
Try 'cut --help' for more information.
host:~ #"""
    result = {
        'LINES': []
    }

    return data, result
