⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.158
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3
/
dist-packages
/
certbot_apache
/
tests
/
View File Name :
entrypoint_test.py
"""Test for certbot_apache.entrypoint for override class resolution""" import unittest import mock from certbot_apache import configurator from certbot_apache import entrypoint class EntryPointTest(unittest.TestCase): """Entrypoint tests""" _multiprocess_can_split_ = True def test_get_configurator(self): with mock.patch("certbot.util.get_os_info") as mock_info: for distro in entrypoint.OVERRIDE_CLASSES: return_value = (distro, "whatever") if distro == 'fedora_old': return_value = ('fedora', '28') elif distro == 'fedora': return_value = ('fedora', '29') mock_info.return_value = return_value self.assertEqual(entrypoint.get_configurator(), entrypoint.OVERRIDE_CLASSES[distro]) def test_nonexistent_like(self): with mock.patch("certbot.util.get_os_info") as mock_info: mock_info.return_value = ("nonexistent", "irrelevant") with mock.patch("certbot.util.get_systemd_os_like") as mock_like: for like in entrypoint.OVERRIDE_CLASSES: mock_like.return_value = [like] self.assertEqual(entrypoint.get_configurator(), entrypoint.OVERRIDE_CLASSES[like]) def test_nonexistent_generic(self): with mock.patch("certbot.util.get_os_info") as mock_info: mock_info.return_value = ("nonexistent", "irrelevant") with mock.patch("certbot.util.get_systemd_os_like") as mock_like: mock_like.return_value = ["unknonwn"] self.assertEqual(entrypoint.get_configurator(), configurator.ApacheConfigurator) if __name__ == "__main__": unittest.main() # pragma: no cover