Correct Parrot OS entry in grains _OS_Family_Map. Fix test.

This commit is contained in:
unman 2022-10-30 00:57:19 +00:00 committed by Megan Wilhite
parent 93f59cda4c
commit d7173d448d
2 changed files with 25 additions and 20 deletions

View file

@ -1824,7 +1824,7 @@ _OS_FAMILY_MAP = {
"Devuan": "Debian",
"antiX": "Debian",
"Kali": "Debian",
"Parrot": "Debian",
"Parrot OS": "Debian",
"neon": "Debian",
"Cumulus": "Debian",
"Deepin": "Debian",

View file

@ -1144,34 +1144,39 @@ def test_endeavouros_os_grains():
}
_run_os_grains_tests(_os_release_data, _os_release_map, expectation)
@pytest.mark.skip_unless_on_linux(reason="System is not Linux")
def test_Parrot_OS_grains(os_release_dir):
@pytest.mark.skip_unless_on_linux
def test_Parrot_OS_grains():
"""
Test if OS grains are parsed correctly in Parrot OS
"""
# /etc/os-release data taken from ParrotOS 5.1
_os_release_data = {
"PRETTY_NAME": "Parrot OS 5.1 (Electro Ara)",
"NAME": "Parrot OS",
"VERSION_ID": "5.1",
"VERSION": "5.1 (Electro Ara)",
"VERSION_CODENAME": "ara",
"ID": "parrot",
"ID_LIKE": "debian",
"HOME_URL": "https://www.parrotsec.org/",
"SUPPORT_URL": "https://community.parrotsec.org/",
"BUG_REPORT_URL": "https://community.parrotsec.org/",
}
_os_release_map = {
"os_release_file": {
"PRETTY_NAME": "Parrot OS 4.11",
"NAME": "Parrot OS",
"ID": "parrot",
"ID_LIKE": "debian",
"VERSION": "4.11",
"VERSION_ID": "4.11",
},
"_linux_distribution": ("Parrot OS", "4.11", ""),
"_linux_distribution": ("Parrot", "5.1", "Electro Ara"),
}
expectation = {
"os": "Parrot OS",
"os_family": "Debian",
"oscodename": "Parrot OS 4.11",
"osfullname": "Parrot OS 4.11",
"osrelease": "4.11",
"osrelease_info": (4, 11),
"osmajorrelease": 4,
"osfinger": "ParrotOS-4",
}
_run_os_grains_tests(os_release_dir, None, _os_release_map, expectation)
"oscodename": "ara",
"osfullname": "Parrot OS",
"osrelease": "5.1",
"osrelease_info": (5, 1),
"osmajorrelease": 5,
"osfinger": "Parrot OS-5",
}
_run_os_grains_tests(_os_release_data, _os_release_map, expectation)
def test_unicode_error():
raise_unicode_mock = MagicMock(name="raise_unicode_error", side_effect=UnicodeError)