Updated for docstring and code quality

This commit is contained in:
Dimitris Zlatanidis 2024-04-29 22:31:08 +03:00
parent 3ffadaffa6
commit 87a84e77c5

View file

@ -4,31 +4,44 @@ from slpkg.upgrade import Upgrade
from slpkg.utilities import Utilities from slpkg.utilities import Utilities
from slpkg.load_data import LoadData from slpkg.load_data import LoadData
class TestUtilities(unittest.TestCase): class TestUtilities(unittest.TestCase):
def setUp(self): """ Test for utilities.
"""
def setUp(self) -> None:
self.load = LoadData() self.load = LoadData()
self.utils = Utilities() self.utils = Utilities()
self.data: dict = self.load.load('sbo') self.data: dict = self.load.load('sbo')
def test_installed_is_upgradable_for_sbo_repository(self): def test_installed_is_upgradable_for_sbo_repository(self) -> None:
""" Test for sbo installed and upgradeable packages.
"""
packages: list = ['sbo-create', 'ptpython', 'pycharm', 'powerline-status'] packages: list = ['sbo-create', 'ptpython', 'pycharm', 'powerline-status']
is_upgradeable: bool = False
for pkg in packages: for pkg in packages:
self.assertFalse(False, Upgrade('sbo', self.data).is_package_upgradeable(pkg)) self.assertFalse(is_upgradeable, Upgrade('sbo', self.data).is_package_upgradeable(pkg))
def test_installed_is_upgradable_for_slack_patches_repository(self): def test_installed_is_upgradable_for_slack_patches_repository(self) -> None:
""" Test for slack installed and upgradeable packages.
"""
repo: str = 'slack_patches' repo: str = 'slack_patches'
data: dict = self.load.load(repo) data: dict = self.load.load(repo)
packages: list = ['vim', 'httpd', 'seamonkey', 'sudo', 'python3', 'qt5', 'php'] packages: list = ['vim', 'httpd', 'seamonkey', 'sudo', 'python3', 'qt5', 'php']
is_upgradeable: bool = False
for pkg in packages: for pkg in packages:
self.assertFalse(False, Upgrade('slack', data).is_package_upgradeable(pkg)) self.assertFalse(is_upgradeable, Upgrade('slack', data).is_package_upgradeable(pkg))
def test_installed_is_upgradable_for_alien_repository(self): def test_installed_is_upgradable_for_alien_repository(self) -> None:
""" Test for alien installed and upgradeable packages.
"""
repo: str = 'alien' repo: str = 'alien'
data: dict = self.load.load(repo) data: dict = self.load.load(repo)
packages: list = ['audacity', 'vlc', 'dnspython'] packages: list = ['audacity', 'vlc', 'dnspython']
is_upgradeable: bool = False
for pkg in packages: for pkg in packages:
self.assertFalse(False, Upgrade('alien', data).is_package_upgradeable(pkg)) self.assertFalse(is_upgradeable, Upgrade('alien', data).is_package_upgradeable(pkg))
if __name__ == '__main__': if __name__ == '__main__':