You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/units/module_utils/facts/system/distribution/test_distribution_sles4sap.py

33 lines
946 B
Python

# -*- coding: utf-8 -*-
# Copyright: (c) 2020 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import annotations
import pytest
from ansible.module_utils.facts.system.distribution import DistributionFiles
@pytest.mark.parametrize('realpath', ('SUSE_SLES_SAP.prod', 'SLES_SAP.prod'))
def test_distribution_sles4sap_suse_sles_sap(mock_module, mocker, realpath):
mocker.patch('os.path.islink', return_value=True)
mocker.patch('os.path.realpath', return_value='/etc/products.d/' + realpath)
test_input = {
'name': 'SUSE',
'path': '',
'data': 'suse',
'collected_facts': None,
}
test_result = (
True,
{
'distribution': 'SLES_SAP',
}
)
distribution = DistributionFiles(module=mock_module())
assert test_result == distribution.parse_distribution_file_SUSE(**test_input)