# -*- coding: utf-8 -*-
# Copyright (c) 2022 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type

from ansible.module_utils.facts.hardware import aix
import pytest

from . aix_data import AIX_PROCESSOR_TEST_SCENARIOS


@pytest.mark.parametrize('scenario', AIX_PROCESSOR_TEST_SCENARIOS)
def test_get_cpu_info(mocker, scenario):
    commands_results = [
        (0, "\n".join(scenario['lsdev_output']), ''),
        (0, "\n".join(scenario['lsattr_type_output']), ''),
        (0, "\n".join(scenario['lsattr_smt_threads_output']), ''),
    ]
    module = mocker.Mock()
    module.run_command = mocker.Mock(side_effect=commands_results)
    inst = aix.AIXHardware(module=module)
    assert scenario['expected_result'] == inst.get_cpu_facts()
