403Webshell
Server IP : 139.59.63.204  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/certbot_apache/_internal/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/certbot_apache/_internal/tests/entrypoint_test.py
"""Test for certbot_apache._internal.entrypoint for override class resolution"""
import sys
from unittest import mock

import pytest

from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint


def test_get_configurator():
    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
            assert entrypoint.get_configurator() == \
                             entrypoint.OVERRIDE_CLASSES[distro]

def test_nonexistent_like():
    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]
                assert entrypoint.get_configurator() == \
                                 entrypoint.OVERRIDE_CLASSES[like]

def test_nonexistent_generic():
    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 = ["unknown"]
            assert entrypoint.get_configurator() == \
                             configurator.ApacheConfigurator


if __name__ == "__main__":
    sys.exit(pytest.main(sys.argv[1:] + [__file__]))  # pragma: no cover

Youez - 2016 - github.com/yon3zu
LinuXploit