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
|
2023-03-02 18:30:11 +01:00
|
|
|
self.package = 'fish-3.6.0-x86_64-1_SBo'
|
2022-06-21 21:00:20 +02:00
|
|
|
|
|
|
|
def test_ins_installed(self):
|
2023-03-03 07:05:20 +01:00
|
|
|
self.assertEqual(self.package, self.utils.is_package_installed('fish', self.file_pattern))
|
2022-12-17 16:13:01 +01:00
|
|
|
|
|
|
|
def test_split_name(self):
|
2023-03-18 20:48:10 +01:00
|
|
|
self.assertEqual('fish', self.utils.split_binary_pkg(self.package)[0])
|
2022-12-17 16:13:01 +01:00
|
|
|
|
|
|
|
def test_split_version(self):
|
2023-03-18 20:48:10 +01:00
|
|
|
self.assertEqual('3.6.0', self.utils.split_binary_pkg(self.package)[1])
|
2022-12-17 16:13:01 +01:00
|
|
|
|
|
|
|
def test_split_arch(self):
|
2023-03-18 20:48:10 +01:00
|
|
|
self.assertEqual('x86_64', self.utils.split_binary_pkg(self.package)[2])
|
2022-12-17 16:13:01 +01:00
|
|
|
|
|
|
|
def test_split_build(self):
|
2023-03-18 20:48:10 +01:00
|
|
|
self.assertEqual('1', self.utils.split_binary_pkg(self.package)[3])
|
2022-12-17 16:13:01 +01:00
|
|
|
|
|
|
|
def test_split_tag(self):
|
2023-03-18 20:48:10 +01:00
|
|
|
self.assertEqual('SBo', self.utils.split_binary_pkg(self.package)[4])
|
2022-06-21 21:00:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|