slpkg/tests/test_utilities.py

36 lines
1.1 KiB
Python
Raw Normal View History

2022-06-21 21:00:20 +02:00
import unittest
from slpkg.utilities import Utilities
from slpkg.configs import Configs
class TestUtilities(unittest.TestCase):
def setUp(self):
self.utils = Utilities()
2023-01-23 22:56:56 +01:00
self.configs = Configs()
self.file_pattern = f'*{self.configs.sbo_repo_tag}'
2022-06-21 21:00:20 +02:00
self.build_path = Configs.build_path
self.package = 'fish-3.4.0-x86_64-2_SBo'
2022-06-21 21:00:20 +02:00
def test_ins_installed(self):
2023-01-23 22:56:56 +01:00
self.assertEqual(self.package, self.utils.is_installed('fish', self.file_pattern))
def test_split_name(self):
self.assertEqual('fish', self.utils.split_installed_pkg(self.package)[0])
def test_split_version(self):
self.assertEqual('3.4.0', self.utils.split_installed_pkg(self.package)[1])
def test_split_arch(self):
self.assertEqual('x86_64', self.utils.split_installed_pkg(self.package)[2])
def test_split_build(self):
self.assertEqual('2', self.utils.split_installed_pkg(self.package)[3])
def test_split_tag(self):
self.assertEqual('SBo', self.utils.split_installed_pkg(self.package)[4])
2022-06-21 21:00:20 +02:00
if __name__ == '__main__':
unittest.main()