slpkg/tests/test_configs.py

71 lines
3.5 KiB
Python
Raw Normal View History

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-05-21 21:01:26 +02:00
"""Testing the configuration."""
2024-04-29 21:22:40 +02:00
def setUp(self) -> None:
2024-05-22 18:21:45 +02:00
"""Set the test."""
2023-04-03 18:21:46 +02:00
self.configs = Configs
2024-04-29 21:22:40 +02:00
def test_configs(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test the 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(['.tgz', '.txz'], self.configs.package_type)
2023-04-03 18:21:46 +02:00
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(True, self.configs.view_missing_deps)
self.assertEqual(False, self.configs.package_method)
self.assertEqual(False, self.configs.downgrade_packages)
self.assertEqual(False, self.configs.delete_sources)
2023-04-03 18:21:46 +02:00
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)
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)
self.assertEqual(False, self.configs.progress_bar_conf)
self.assertEqual('spinner', self.configs.progress_spinner)
2023-04-03 18:21:46 +02:00
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()