mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 21:44:16 +02:00
[arch] fix: displaying already installed packages when suggesting optional dependencies
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import os
|
||||
import warnings
|
||||
from unittest import TestCase
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
from bauh import __app_name__
|
||||
from bauh.gems.arch import pacman
|
||||
|
||||
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -26,3 +28,71 @@ class PacmanTest(TestCase):
|
||||
|
||||
self.assertIsNotNone(ignored)
|
||||
self.assertEqual(0, len(ignored))
|
||||
|
||||
@patch(f'{__app_name__}.gems.arch.pacman.run_cmd', return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
Depends On : embree freetype2 libglvnd
|
||||
Optional Deps : lib32-vulkan-icd-loader: Vulkan support [installed]
|
||||
Required By : None
|
||||
""")
|
||||
def test_map_optional_deps__no_remote_and_not_installed__only_one_installed_with_description(self, run_cmd: Mock):
|
||||
res = pacman.map_optional_deps(('package-test',), remote=False, not_installed=True)
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {}}, res)
|
||||
|
||||
@patch(f'{__app_name__}.gems.arch.pacman.run_cmd', return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
Depends On : embree freetype2 libglvnd
|
||||
Optional Deps : lib32-vulkan-icd-loader: Vulkan support
|
||||
Required By : None
|
||||
""")
|
||||
def test_map_optional_deps__no_remote_and_not_installed__only_one_not_installed_with_description(self, run_cmd: Mock):
|
||||
res = pacman.map_optional_deps(('package-test',), remote=False, not_installed=True)
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {'lib32-vulkan-icd-loader': 'Vulkan support'}}, res)
|
||||
|
||||
@patch(f'{__app_name__}.gems.arch.pacman.run_cmd', return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
Depends On : embree freetype2 libglvnd
|
||||
Optional Deps : pipewire-alsa
|
||||
Required By : None
|
||||
""")
|
||||
def test_map_optional_deps__no_remote_and_not_installed__only_one_not_installed_no_description(self, run_cmd: Mock):
|
||||
res = pacman.map_optional_deps(('package-test',), remote=False, not_installed=True)
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {'pipewire-alsa': ''}}, res)
|
||||
|
||||
@patch(f'{__app_name__}.gems.arch.pacman.run_cmd', return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
Depends On : embree freetype2 libglvnd
|
||||
Optional Deps : pipewire-alsa [installed]
|
||||
Required By : None
|
||||
""")
|
||||
def test_map_optional_deps__no_remote_and_not_installed__only_one_installed_no_description(self, run_cmd: Mock):
|
||||
res = pacman.map_optional_deps(('package-test',), remote=False, not_installed=True)
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {}}, res)
|
||||
|
||||
@patch(f'{__app_name__}.gems.arch.pacman.run_cmd', return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
Depends On : embree freetype2 libglvnd libtheora
|
||||
Optional Deps : pipewire-alsa
|
||||
pipewire-pulse [installed]
|
||||
pipewire
|
||||
lib32-vulkan-icd-loader: Vulkan support [installed]
|
||||
Required By : None
|
||||
""")
|
||||
def test_map_optional_deps__no_remote_and_not_installed__several(self, run_cmd: Mock):
|
||||
res = pacman.map_optional_deps(('package-test',), remote=False, not_installed=True)
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {'pipewire-alsa': '', 'pipewire': ''}}, res)
|
||||
|
||||
Reference in New Issue
Block a user