mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
Merge branch 'master' into staging
# Conflicts: # bauh/gems/appimage/controller.py # bauh/gems/arch/updates.py
This commit is contained in:
@@ -9,7 +9,7 @@ class GetHumanSizeStrTest(TestCase):
|
||||
def setUp(self):
|
||||
try:
|
||||
locale.setlocale(locale.LC_NUMERIC, "C")
|
||||
except:
|
||||
except Exception:
|
||||
print("Error: could not set locale.LC_NUMERIC to None")
|
||||
|
||||
def test__must_properly_display_B(self):
|
||||
@@ -53,4 +53,3 @@ class GetHumanSizeStrTest(TestCase):
|
||||
def test__must_not_concatenate_the_plus_sign_if_positive_sign_is_true_and_value_is_negative(self):
|
||||
self.assertEqual('-999 B', get_human_size_str(-999, positive_sign=True))
|
||||
self.assertEqual('-1.00 kB', get_human_size_str(-1000, positive_sign=True))
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ X-AppImage-Version=bionic-0.16.0-83-dev-0ca783e
|
||||
appname='gamehub',
|
||||
file_path='/path/to/gamehub.appimage')
|
||||
|
||||
expected = """
|
||||
expected = """
|
||||
[Desktop Entry]
|
||||
Name=GameHub
|
||||
GenericName=GameHub
|
||||
|
||||
@@ -64,9 +64,9 @@ 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)
|
||||
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
|
||||
|
||||
@@ -135,7 +135,7 @@ class SortingTest(TestCase):
|
||||
self.assertEqual(sorted_list[0][0], 'def')
|
||||
self.assertEqual(sorted_list[1][0], 'ghi')
|
||||
|
||||
self.assertNotEqual(sorted_list[2][0], sorted_list[3][0])
|
||||
self.assertNotEqual(sorted_list[2][0], sorted_list[3][0])
|
||||
self.assertIn(sorted_list[2][0], {'abc', 'jkl'})
|
||||
self.assertIn(sorted_list[3][0], {'abc', 'jkl'})
|
||||
|
||||
@@ -179,7 +179,7 @@ class SortingTest(TestCase):
|
||||
self.assertEqual(sorted_list[0][0], 'def')
|
||||
self.assertEqual(sorted_list[1][0], 'abc')
|
||||
self.assertEqual(sorted_list[2][0], 'ghi')
|
||||
|
||||
|
||||
def test_sort__aur_pkgs_should_be_always_in_the_end(self):
|
||||
"""
|
||||
dep order:
|
||||
|
||||
@@ -58,7 +58,7 @@ gimp-help^<none>^<none>^<none>^^
|
||||
self.assertEqual([p.__dict__ for p in exp], [p.__dict__ for p in res])
|
||||
|
||||
@patch(f'{__app_name__}.gems.debian.aptitude.system.execute', return_value=(0, """
|
||||
Package: firefox
|
||||
Package: firefox
|
||||
Version: 97.0+distro1+una
|
||||
State: installed (95.0.1+distro1.1+una), upgrade available (97.0+distro1+una)
|
||||
Automatically installed: no
|
||||
@@ -89,8 +89,8 @@ Suggests: gcc-multilib, make, manpages-dev, autoconf, automake, libtool, flex, b
|
||||
Conflicts: gcc-doc (< 1:2.95.3), gcc-doc:i386 (< 1:2.95.3), gcc:i386
|
||||
Provides: c-compiler, gcc-x86-64-linux-gnu (= 4:9.3.0-1distro2), gcc:amd64 (= 4:9.3.0-1distro2)
|
||||
Description: GNU C compiler
|
||||
This is the GNU C compiler, a fairly portable optimizing compiler for C.
|
||||
|
||||
This is the GNU C compiler, a fairly portable optimizing compiler for C.
|
||||
|
||||
This is a dependency package providing the default GNU C compiler.
|
||||
|
||||
"""))
|
||||
@@ -170,7 +170,7 @@ Description: GNU C compiler
|
||||
def test_map_transaction_output__it_should_map_i386_packages(self):
|
||||
output = "\nThe following NEW packages will be installed:\n" \
|
||||
" gcc-12-base:i386{a} [12.1.0-2distro~22.04] <+272 kB> glib-networking:i386{a} [2.72.0-1] <+242 kB>\n" \
|
||||
"\nThe following packages will be REMOVED:\n" \
|
||||
"\nThe following packages will be REMOVED:\n" \
|
||||
" celluloid{a} [0.21-linux+distro] <-1066 kB> libpcre3:i386{a} [2:8.39-13distro0.22.04.1] <-714 kB>"
|
||||
|
||||
transaction = self.aptitude.map_transaction_output(output)
|
||||
|
||||
@@ -14,14 +14,14 @@ class DebianPackageManagerTest(TestCase):
|
||||
self.controller._apps_index = {}
|
||||
|
||||
@patch(f'{__app_name__}.gems.debian.controller.Aptitude.read_installed', return_value=iter((
|
||||
DebianPackage(name='gir1.2-javascriptcoregtk-4.0', version='2.34.1-0distro0.20.04.1',
|
||||
latest_version='2.34.1-0distro0.20.04.1',
|
||||
maintainer='Distro Developers', update=False, installed=True,
|
||||
description='JavaScript engine library from WebKitGTK - GObject introspection data'),
|
||||
DebianPackage(name='xwayland', version='2:1.20.13-1distro1~20.04.2',
|
||||
latest_version='2:1.20.13-1distro1~20.04.2',
|
||||
maintainer='Distro X-SWAT', update=False, installed=True,
|
||||
description='Xwayland X server')
|
||||
DebianPackage(name='gir1.2-javascriptcoregtk-4.0', version='2.34.1-0distro0.20.04.1',
|
||||
latest_version='2.34.1-0distro0.20.04.1',
|
||||
maintainer='Distro Developers', update=False, installed=True,
|
||||
description='JavaScript engine library from WebKitGTK - GObject introspection data'),
|
||||
DebianPackage(name='xwayland', version='2:1.20.13-1distro1~20.04.2',
|
||||
latest_version='2:1.20.13-1distro1~20.04.2',
|
||||
maintainer='Distro X-SWAT', update=False, installed=True,
|
||||
description='Xwayland X server')
|
||||
)))
|
||||
def test_read_installed__must_associated_packages_found_to_applications_if_appliable(self, read_installed: Mock):
|
||||
app = DebianApplication(name='xwayland', exe_path='xwayland', icon_path='xwayland', categories=('app',))
|
||||
@@ -44,14 +44,14 @@ class DebianPackageManagerTest(TestCase):
|
||||
self.assertEqual(expected, result.installed)
|
||||
|
||||
@patch(f'{__app_name__}.gems.debian.controller.Aptitude.read_installed', return_value=iter((
|
||||
DebianPackage(name='gir1.2-javascriptcoregtk-4.0', version='2.34.1-0distro0.20.04.1',
|
||||
latest_version='2.34.1-0distro0.20.04.1',
|
||||
maintainer='Distro Developers', update=False, installed=True,
|
||||
description='JavaScript engine library from WebKitGTK - GObject introspection data'),
|
||||
DebianPackage(name='xwayland', version='2:1.20.13-1distro1~20.04.2',
|
||||
latest_version='2:1.20.13-1distro1~20.04.2',
|
||||
maintainer='Distro X-SWAT', update=False, installed=True,
|
||||
description='Xwayland X server')
|
||||
DebianPackage(name='gir1.2-javascriptcoregtk-4.0', version='2.34.1-0distro0.20.04.1',
|
||||
latest_version='2.34.1-0distro0.20.04.1',
|
||||
maintainer='Distro Developers', update=False, installed=True,
|
||||
description='JavaScript engine library from WebKitGTK - GObject introspection data'),
|
||||
DebianPackage(name='xwayland', version='2:1.20.13-1distro1~20.04.2',
|
||||
latest_version='2:1.20.13-1distro1~20.04.2',
|
||||
maintainer='Distro X-SWAT', update=False, installed=True,
|
||||
description='Xwayland X server')
|
||||
)))
|
||||
def test_read_installed__internet_not_available(self, read_installed: Mock):
|
||||
result = self.controller.read_installed(disk_loader=None, pkg_types=None, internet_available=False)
|
||||
@@ -83,7 +83,7 @@ class DebianPackageManagerTest(TestCase):
|
||||
)))
|
||||
def test_search__returned_packages_should_be_associated_with_apps_if_appliable(self, search: Mock):
|
||||
app = DebianApplication(name='myapp', exe_path='myapp', icon_path='myapp',
|
||||
categories=('app',))
|
||||
categories=('app',))
|
||||
self.controller._apps_index = {'myapp': app}
|
||||
|
||||
words = 'test'
|
||||
|
||||
@@ -8,6 +8,7 @@ from bauh.gems.debian.index import ApplicationsMapper, ApplicationIndexer
|
||||
from bauh.gems.debian.model import DebianApplication
|
||||
from tests.gems.debian import DEBIAN_TESTS_DIR
|
||||
|
||||
|
||||
def mock_read_file(fpath: str):
|
||||
if fpath.endswith('firefox.desktop'):
|
||||
return """
|
||||
|
||||
@@ -10,10 +10,10 @@ class FlatpakTest(TestCase):
|
||||
@patch(f'{__app_name__}.gems.flatpak.flatpak.SimpleProcess')
|
||||
@patch(f'{__app_name__}.gems.flatpak.flatpak.ProcessHandler.handle_simple', return_value=(True, """
|
||||
Looking for updates...
|
||||
|
||||
|
||||
\tID\tArch\tBranch\tRemote\tDownload
|
||||
1.\t \torg.xpto.Xnote\tx86_64\tstable\tflathub\t< 4.3 MB
|
||||
|
||||
|
||||
"""))
|
||||
def test_map_update_download_size__for_flatpak_1_2(self, SimpleProcess: Mock, handle_simple: Mock):
|
||||
download_size = flatpak.map_update_download_size(app_ids={'org.xpto.Xnote'}, installation='user', version=VERSION_1_2)
|
||||
|
||||
@@ -61,4 +61,3 @@ class WebApplicationManagerTest(TestCase):
|
||||
def test_strip_url_protocol__https_with_www(self):
|
||||
res = self.manager.strip_url_protocol('https://www.test.com')
|
||||
self.assertEqual('test.com', res)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user