slpkg/tests/test_utilities.py

38 lines
1.1 KiB
Python
Raw Normal View History

2022-06-21 21:00:20 +02:00
import unittest
2023-03-20 20:22:56 +01:00
2022-06-21 21:00:20 +02:00
from slpkg.configs import Configs
2023-03-20 20:22:56 +01:00
from slpkg.utilities import Utilities
from slpkg.repositories import Repositories
2022-06-21 21:00:20 +02:00
class TestUtilities(unittest.TestCase):
def setUp(self):
self.utils = Utilities()
2023-01-23 22:56:56 +01:00
self.configs = Configs()
2023-03-20 20:22:56 +01:00
self.repos = Repositories()
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-26 07:54:59 +02:00
self.assertEqual(self.package, self.utils.is_package_installed('fish'))
def test_split_name(self):
2023-03-18 20:48:10 +01:00
self.assertEqual('fish', self.utils.split_binary_pkg(self.package)[0])
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])
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])
def test_split_build(self):
2023-03-18 20:48:10 +01:00
self.assertEqual('1', self.utils.split_binary_pkg(self.package)[3])
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()