2023-04-04 09:42:30 +02:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from slpkg.upgrade import Upgrade
|
2023-04-09 19:38:17 +02:00
|
|
|
from slpkg.utilities import Utilities
|
2024-03-21 17:33:33 +01:00
|
|
|
from slpkg.load_data import LoadData
|
2023-04-04 09:42:30 +02:00
|
|
|
|
2024-04-29 21:31:08 +02:00
|
|
|
|
2023-04-04 09:42:30 +02:00
|
|
|
class TestUtilities(unittest.TestCase):
|
|
|
|
|
2024-04-29 21:31:08 +02:00
|
|
|
""" Test for utilities.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
2024-03-21 17:33:33 +01:00
|
|
|
self.load = LoadData()
|
2023-04-04 09:42:30 +02:00
|
|
|
self.utils = Utilities()
|
2024-03-21 17:33:33 +01:00
|
|
|
self.data: dict = self.load.load('sbo')
|
2023-04-09 19:38:17 +02:00
|
|
|
|
2024-04-29 21:31:08 +02:00
|
|
|
def test_installed_is_upgradable_for_sbo_repository(self) -> None:
|
|
|
|
""" Test for sbo installed and upgradeable packages.
|
|
|
|
"""
|
2023-04-09 19:38:17 +02:00
|
|
|
packages: list = ['sbo-create', 'ptpython', 'pycharm', 'powerline-status']
|
2024-04-29 21:31:08 +02:00
|
|
|
is_upgradeable: bool = False
|
2023-04-09 19:38:17 +02:00
|
|
|
for pkg in packages:
|
2024-04-29 21:31:08 +02:00
|
|
|
self.assertFalse(is_upgradeable, Upgrade('sbo', self.data).is_package_upgradeable(pkg))
|
2023-04-09 19:38:17 +02:00
|
|
|
|
2024-04-29 21:31:08 +02:00
|
|
|
def test_installed_is_upgradable_for_slack_patches_repository(self) -> None:
|
|
|
|
""" Test for slack installed and upgradeable packages.
|
|
|
|
"""
|
2023-04-09 19:38:17 +02:00
|
|
|
repo: str = 'slack_patches'
|
2024-03-21 17:33:33 +01:00
|
|
|
data: dict = self.load.load(repo)
|
2023-04-19 16:03:34 +02:00
|
|
|
packages: list = ['vim', 'httpd', 'seamonkey', 'sudo', 'python3', 'qt5', 'php']
|
2024-04-29 21:31:08 +02:00
|
|
|
is_upgradeable: bool = False
|
2023-04-09 19:38:17 +02:00
|
|
|
for pkg in packages:
|
2024-04-29 21:31:08 +02:00
|
|
|
self.assertFalse(is_upgradeable, Upgrade('slack', data).is_package_upgradeable(pkg))
|
2023-04-09 19:38:17 +02:00
|
|
|
|
2024-04-29 21:31:08 +02:00
|
|
|
def test_installed_is_upgradable_for_alien_repository(self) -> None:
|
|
|
|
""" Test for alien installed and upgradeable packages.
|
|
|
|
"""
|
2023-04-09 19:38:17 +02:00
|
|
|
repo: str = 'alien'
|
2024-03-21 17:33:33 +01:00
|
|
|
data: dict = self.load.load(repo)
|
2023-04-09 19:38:17 +02:00
|
|
|
packages: list = ['audacity', 'vlc', 'dnspython']
|
2024-04-29 21:31:08 +02:00
|
|
|
is_upgradeable: bool = False
|
2023-04-09 19:38:17 +02:00
|
|
|
for pkg in packages:
|
2024-04-29 21:31:08 +02:00
|
|
|
self.assertFalse(is_upgradeable, Upgrade('alien', data).is_package_upgradeable(pkg))
|
2023-04-05 22:09:26 +02:00
|
|
|
|
2023-04-04 09:42:30 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|