mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Updated test utils
This commit is contained in:
parent
eb3c4d3728
commit
44ecc42696
1 changed files with 35 additions and 8 deletions
|
@ -9,28 +9,55 @@ class TestUtilities(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self.utils = Utilities()
|
||||
self.configs = Configs()
|
||||
self.repos = Repositories()
|
||||
# self.configs = Configs()
|
||||
# self.repos = Repositories()
|
||||
self.build_path = Configs.build_path
|
||||
self.package = 'fish-3.6.0-x86_64-1_SBo'
|
||||
self.package = 'aaa_base-15.0-x86_64-4_slack15.0'
|
||||
|
||||
def test_ins_installed(self):
|
||||
self.assertEqual(self.package, self.utils.is_package_installed('fish'))
|
||||
self.assertEqual(self.package, self.utils.is_package_installed('aaa_base'))
|
||||
|
||||
def test_split_name(self):
|
||||
self.assertEqual('fish', self.utils.split_binary_pkg(self.package)[0])
|
||||
self.assertEqual('aaa_base', self.utils.split_binary_pkg(self.package)[0])
|
||||
|
||||
def test_split_version(self):
|
||||
self.assertEqual('3.6.0', self.utils.split_binary_pkg(self.package)[1])
|
||||
self.assertEqual('15.0', self.utils.split_binary_pkg(self.package)[1])
|
||||
|
||||
def test_split_arch(self):
|
||||
self.assertEqual('x86_64', self.utils.split_binary_pkg(self.package)[2])
|
||||
|
||||
def test_split_build(self):
|
||||
self.assertEqual('1', self.utils.split_binary_pkg(self.package)[3])
|
||||
self.assertEqual('4', self.utils.split_binary_pkg(self.package)[3])
|
||||
|
||||
def test_split_tag(self):
|
||||
self.assertEqual('SBo', self.utils.split_binary_pkg(self.package)[4])
|
||||
self.assertEqual('slack15.0', self.utils.split_binary_pkg(self.package)[4])
|
||||
|
||||
def test_is_installed(self):
|
||||
self.assertEqual(self.package, self.utils.is_package_installed('aaa_base'))
|
||||
|
||||
def test_all_installed(self):
|
||||
self.assertIn(self.package, self.utils.all_installed())
|
||||
|
||||
def test_all_installed_names(self):
|
||||
self.assertIn('aaa_base', self.utils.all_installed_names())
|
||||
self.assertIn('vim', self.utils.all_installed_names())
|
||||
self.assertIn('nano', self.utils.all_installed_names())
|
||||
self.assertIn('wget', self.utils.all_installed_names())
|
||||
self.assertIn('curl', self.utils.all_installed_names())
|
||||
self.assertIn('lftp', self.utils.all_installed_names())
|
||||
|
||||
def test_read_build_tag(self):
|
||||
self.assertEqual('1', self.utils.read_sbo_build_tag('slpkg'))
|
||||
|
||||
def test_is_option(self):
|
||||
self.assertTrue(True, self.utils.is_option(['-P', '--parallel'],
|
||||
['-k', '-p', '-P', '--parallel', '--bin-repo']))
|
||||
|
||||
def test_get_file_size(self):
|
||||
self.assertEqual('2154 KB', self.utils.get_file_size(f'/var/log/packages/{self.package}'))
|
||||
|
||||
def test_apply_package_pattern(self):
|
||||
self.assertGreater(len(self.utils.apply_package_pattern([], ['*'], '')), 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue