import time


def check_cli_output_with_mocker(dut, mocker_object, command, max_wait_time, key_index=0):
    """
    Check the command line output matches the mocked data.
    :param dut: DUT object representing a SONiC switch under test.
    :param mocker_object: A mocker instance.
    :param command: The command to be executed. E.g, 'show platform fan'
    :param max_wait_time: Max wait time.
    :return: True if the actual data matches the mocked data.
    """
    time.sleep(max_wait_time)

    result = dut.show_and_parse(command)
    assert len(result) > 0, "Run and parse output of command '{}' failed".format(command)
    return mocker_object.check_result(result)