slpkg/tests/test_configs.py
2024-04-29 22:22:40 +03:00

69 lines
3.3 KiB
Python

import unittest
from pathlib import Path
from slpkg.configs import Configs
class TestConfigs(unittest.TestCase):
""" Test general configs.
"""
def setUp(self) -> None:
self.configs = Configs
def test_configs(self) -> None:
""" Test all configs.
"""
self.assertEqual('slpkg', self.configs.prog_name)
self.assertEqual('x86_64', self.configs.os_arch)
self.assertEqual(Path('/tmp'), self.configs.tmp_path)
self.assertEqual(Path('/tmp/slpkg'), self.configs.tmp_slpkg)
self.assertEqual(Path('/tmp/slpkg/build'), self.configs.build_path)
self.assertEqual(Path('/tmp/slpkg/'), self.configs.download_only_path)
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)
self.assertEqual(Path('/var/log/slpkg/deps.log'), self.configs.deps_log_file)
self.assertEqual(Path('/var/log/slpkg/slpkg.log'), self.configs.slpkg_log_file)
self.assertEqual(Path('/var/log/slpkg/upgrade.log'), self.configs.upgrade_log_file)
self.assertEqual('.pkgs', self.configs.file_list_suffix)
self.assertEqual('upgradepkg --install-new', self.configs.installpkg)
self.assertEqual('upgradepkg --reinstall', self.configs.reinstall)
self.assertEqual('removepkg', self.configs.removepkg)
self.assertEqual(True, self.configs.colors)
self.assertEqual('-j4', self.configs.makeflags)
self.assertEqual(False, self.configs.gpg_verification)
self.assertEqual(True, self.configs.checksum_md5)
self.assertEqual(True, self.configs.dialog)
self.assertEqual(False, self.configs.new_packages)
self.assertEqual(False, self.configs.removed_packages)
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)
self.assertEqual('-c mirror --parallel=100 --only-newer --delete', self.configs.lftp_mirror_options)
self.assertEqual(True, self.configs.ascii_characters)
self.assertEqual(True, self.configs.ask_question)
self.assertEqual(True, self.configs.kernel_version)
self.assertEqual(False, self.configs.parallel_downloads)
self.assertEqual(5, self.configs.maximum_parallel)
self.assertEqual(True, self.configs.progress_bar_conf)
self.assertEqual('pixel', self.configs.progress_spinner)
self.assertEqual('green', self.configs.spinner_color)
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)
self.assertEqual('', self.configs.proxy_address)
self.assertEqual('', self.configs.proxy_username)
self.assertEqual('', self.configs.proxy_password)
if __name__ == '__main__':
unittest.main()