Server IP : 80.241.246.6 / Your IP : 216.73.216.129 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/letsencrypt/certbot-apache/tests/ |
Upload File : |
"""Test for certbot_apache._internal.entrypoint for override class resolution""" import unittest try: import mock except ImportError: # pragma: no cover from unittest import mock # type: ignore from certbot_apache._internal import configurator from certbot_apache._internal 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