2022-06-21 18:00:05 +02:00
|
|
|
import unittest
|
2023-04-03 18:21:46 +02:00
|
|
|
from pathlib import Path
|
2024-04-29 21:22:40 +02:00
|
|
|
from slpkg.configs import Configs
|
2022-06-21 18:00:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TestConfigs(unittest.TestCase):
|
|
|
|
|
2024-04-29 21:22:40 +02:00
|
|
|
""" Test general configs.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
2023-04-03 18:21:46 +02:00
|
|
|
self.configs = Configs
|
|
|
|
|
2024-04-29 21:22:40 +02:00
|
|
|
def test_configs(self) -> None:
|
|
|
|
""" Test all configs.
|
|
|
|
"""
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual('slpkg', self.configs.prog_name)
|
|
|
|
self.assertEqual('x86_64', self.configs.os_arch)
|
2023-04-26 16:25:42 +02:00
|
|
|
self.assertEqual(Path('/tmp'), self.configs.tmp_path)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual(Path('/tmp/slpkg'), self.configs.tmp_slpkg)
|
2024-03-21 17:33:33 +01:00
|
|
|
self.assertEqual(Path('/tmp/slpkg/build'), self.configs.build_path)
|
2023-04-26 16:25:42 +02:00
|
|
|
self.assertEqual(Path('/tmp/slpkg/'), self.configs.download_only_path)
|
2024-03-25 21:59:59 +01:00
|
|
|
self.assertEqual(Path('/etc/slpkg'), self.configs.etc_path)
|
|
|
|
self.assertEqual(Path('/var/lib/slpkg'), self.configs.lib_path)
|
|
|
|
self.assertEqual(Path('/var/log/slpkg/'), self.configs.log_path)
|
|
|
|
self.assertEqual(Path('/var/log/packages'), self.configs.log_packages)
|
2024-03-21 17:33:33 +01:00
|
|
|
|
|
|
|
self.assertEqual(Path('/var/log/slpkg/deps.log'), self.configs.deps_log_file)
|
2024-03-25 21:59:59 +01:00
|
|
|
self.assertEqual(Path('/var/log/slpkg/slpkg.log'), self.configs.slpkg_log_file)
|
2024-04-01 15:04:52 +02:00
|
|
|
self.assertEqual(Path('/var/log/slpkg/upgrade.log'), self.configs.upgrade_log_file)
|
2023-04-03 18:21:46 +02:00
|
|
|
|
|
|
|
self.assertEqual('.pkgs', self.configs.file_list_suffix)
|
|
|
|
self.assertEqual('upgradepkg --install-new', self.configs.installpkg)
|
2023-04-26 09:58:36 +02:00
|
|
|
self.assertEqual('upgradepkg --reinstall', self.configs.reinstall)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual('removepkg', self.configs.removepkg)
|
|
|
|
self.assertEqual(True, self.configs.colors)
|
2024-03-21 17:33:33 +01:00
|
|
|
self.assertEqual('-j4', self.configs.makeflags)
|
|
|
|
self.assertEqual(False, self.configs.gpg_verification)
|
|
|
|
self.assertEqual(True, self.configs.checksum_md5)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual(True, self.configs.dialog)
|
|
|
|
self.assertEqual('wget', self.configs.downloader)
|
|
|
|
self.assertEqual('-c -q --progress=bar:force:noscroll --show-progress', self.configs.wget_options)
|
|
|
|
self.assertEqual('', self.configs.curl_options)
|
|
|
|
self.assertEqual('-c get -e', self.configs.lftp_get_options)
|
2024-03-21 17:33:33 +01:00
|
|
|
self.assertEqual('-c mirror --parallel=100 --only-newer --delete', self.configs.lftp_mirror_options)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual(True, self.configs.ascii_characters)
|
|
|
|
self.assertEqual(True, self.configs.ask_question)
|
2024-04-15 18:43:49 +02:00
|
|
|
self.assertEqual(True, self.configs.kernel_version)
|
2024-05-11 22:29:34 +02:00
|
|
|
self.assertEqual(False, self.configs.slackpkg_changelog)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual(False, self.configs.parallel_downloads)
|
2024-04-06 17:39:00 +02:00
|
|
|
self.assertEqual(5, self.configs.maximum_parallel)
|
2024-04-22 19:24:47 +02:00
|
|
|
self.assertEqual(True, self.configs.progress_bar_conf)
|
2023-04-03 18:21:46 +02:00
|
|
|
self.assertEqual('pixel', self.configs.progress_spinner)
|
|
|
|
self.assertEqual('green', self.configs.spinner_color)
|
2024-03-21 17:33:33 +01:00
|
|
|
self.assertEqual('bold_green', self.configs.border_color)
|
|
|
|
self.assertEqual(True, self.configs.process_log)
|
|
|
|
|
|
|
|
self.assertEqual(False, self.configs.urllib_retries)
|
|
|
|
self.assertEqual(False, self.configs.urllib_redirect)
|
|
|
|
self.assertEqual(3.0, self.configs.urllib_timeout)
|
|
|
|
|
2023-04-17 09:56:42 +02:00
|
|
|
self.assertEqual('', self.configs.proxy_address)
|
2023-04-13 11:36:05 +02:00
|
|
|
self.assertEqual('', self.configs.proxy_username)
|
|
|
|
self.assertEqual('', self.configs.proxy_password)
|
2022-06-21 18:00:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|