repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
certbot | certbot/src/certbot/errors.py | .py | """Certbot client errors."""
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from certbot.achallenges import AnnotatedChallenge
class Error(Exception):
"""Generic Certbot client error."""
class AccountStorageError(Error):
"""Generic `.AccountStorage` error."""
class AccountNotFound(AccountStorageE... | 115 | 2,773 |
certbot | certbot/src/certbot/main.py | .py | """Certbot main public entry point."""
from typing import Optional
from typing import Union
from certbot._internal import main as internal_main
def main(cli_args: Optional[list[str]] = None) -> Optional[Union[str, int]]:
"""Run Certbot.
:param cli_args: command line to Certbot, defaults to ``sys.argv[1:]``
... | 19 | 511 |
certbot | certbot/src/certbot/crypto_util.py | .py | """Certbot client crypto utility functions.
.. todo:: Make the transition to use PSS rather than PKCS1_v1_5 when the server
is capable of handling the signatures.
"""
import datetime
import hashlib
import ipaddress
import logging
import re
from typing import Optional
from typing import TYPE_CHECKING
from typing i... | 650 | 24,558 |
certbot | certbot/src/certbot/util.py | .py | """Utilities for all Certbot."""
import argparse
import atexit
import errno
import itertools
import logging
import platform
import re
import socket
import subprocess
import sys
from typing import Any
from typing import Callable
from typing import IO
from typing import NamedTuple
from typing import Optional
from typing ... | 739 | 26,050 |
certbot | certbot/src/certbot/__init__.py | .py | """Certbot client."""
# version number like 1.2.3a0, must have at least 2 parts, like 1.2
__version__ = '5.8.0.dev0'
| 5 | 118 |
certbot | certbot/src/certbot/ocsp.py | .py | """Deprecated tools for checking certificate revocation."""
import warnings
# ruff: disable[F403]
from certbot._internal.ocsp import * # pylint: disable=wildcard-import,unused-wildcard-import
# ruff: enable[F403]
warnings.warn("certbot.ocsp is deprecated and will be removed in the next major"
" release... | 10 | 357 |
certbot | certbot/src/certbot/reverter.py | .py | """Reverter class saves configuration checkpoints and allows for recovery."""
import csv
import glob
import logging
import shutil
import time
import traceback
from typing import Iterable
from typing import TextIO
from certbot import configuration
from certbot import errors
from certbot import util
from certbot._intern... | 525 | 21,942 |
certbot | certbot/src/certbot/interfaces.py | .py | """Certbot client interfaces."""
from abc import ABCMeta
from abc import abstractmethod
from argparse import ArgumentParser
from typing import Any
from typing import Iterable
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from acme.challenges import Challenge
from acme.challenges... | 484 | 15,558 |
certbot | certbot/src/certbot/achallenges.py | .py | """Client annotated ACME challenges.
Please use names such as ``achall`` to distinguish from variables "of type"
:class:`acme.challenges.Challenge` (denoted by ``chall``)
and :class:`.ChallengeBody` (denoted by ``challb``)::
from acme import challenges
from acme import messages
from certbot import achallenges
... | 107 | 3,948 |
certbot | certbot/src/certbot/display/util.py | .py | """Certbot display.
This module (`certbot.display.util`) or its companion `certbot.display.ops`
should be used whenever:
- Displaying status information to the user on the terminal
- Collecting information from the user via prompts
Other messages can use the `logging` module. See `log.py`.
"""
from typing import Op... | 182 | 7,219 |
certbot | certbot/src/certbot/display/ops.py | .py | """Contains UI methods for LE user operations."""
import logging
from textwrap import indent
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Optional
from certbot import errors
from certbot import interfaces
from certbot import util
from certbot._internal import accoun... | 353 | 12,163 |
certbot | certbot/src/certbot/tests/acme_util.py | .py | """ACME utilities for testing."""
import datetime
from typing import Any
from typing import Iterable
import josepy as jose
from acme import challenges
from acme import messages
from certbot._internal import auth_handler
from certbot.tests import util
JWK = jose.JWK.load(util.load_vector('rsa512_key.pem'))
KEY = util... | 91 | 2,934 |
certbot | certbot/src/certbot/tests/util.py | .py | """Test utilities."""
import atexit
from contextlib import ExitStack
import copy
from importlib import reload as reload_module
import importlib.resources
import io
import logging
import multiprocessing
from multiprocessing import synchronize
import shutil
import sys
import tempfile
from typing import Any
from typing im... | 460 | 17,396 |
certbot | certbot/src/certbot/compat/_path.py | .py | """
This compat module wraps os.path to forbid some functions.
isort:skip_file
"""
# NB: Each function defined in compat._path is marked with "type: ignore" to avoid mypy
# to complain that a function is redefined (because we imported if first from os.path).
# pylint: disable=function-redefined
from __future__ i... | 40 | 1,810 |
certbot | certbot/src/certbot/compat/filesystem.py | .py | """Compat module to handle files security on Windows and Linux"""
from __future__ import absolute_import
from contextlib import contextmanager
import errno
import os # pylint: disable=os-module-forbidden
import stat
from typing import Any
from typing import Generator
from typing import Optional
try:
import ntsec... | 732 | 29,826 |
certbot | certbot/src/certbot/compat/misc.py | .py | """
This compat module handles various platform specific calls that do not fall into one
particular category.
"""
from __future__ import absolute_import
import logging
import select
import subprocess
import sys
from typing import Optional
from certbot import errors
from certbot.compat import os
try:
from pywinty... | 169 | 5,387 |
certbot | certbot/src/certbot/compat/__init__.py | .py | """
Compatibility layer to run certbot both on Linux and Windows.
This package contains all logic that needs to be implemented specifically for Linux and for Windows.
Then the rest of certbot code relies on this module to be platform agnostic.
"""
| 7 | 249 |
certbot | certbot/src/certbot/compat/os.py | .py | """
This compat modules is a wrapper of the core os module that forbids usage of specific operations
(e.g. chown, chmod, getuid) that would be harmful to the Windows file security model of Certbot.
This module is intended to replace standard os module throughout certbot projects (except acme).
This module has the same... | 173 | 9,599 |
certbot | certbot/src/certbot/plugins/apache.py | .py | """Despite being public API, this is only meant for use in our certbot-apache plugin, and isn't
intended for public use."""
from certbot._internal.plugins.apache import entrypoint
ENTRYPOINT = entrypoint.get_configurator()
| 8 | 226 |
certbot | certbot/src/certbot/plugins/dns_test_common_lexicon.py | .py | """Base test class for DNS authenticators built on Lexicon."""
import contextlib
import sys
from types import ModuleType
from typing import Any
from typing import cast
from typing import Generator
from typing import Protocol
from unittest import mock
from unittest.mock import MagicMock
import warnings
import josepy as... | 355 | 15,667 |
certbot | certbot/src/certbot/plugins/storage.py | .py | """Plugin storage class."""
import json
import logging
from typing import Any
from certbot import configuration
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
logger = logging.getLogger(__name__)
class PluginStorage:
"""Class implementing storage functionality for... | 124 | 4,270 |
certbot | certbot/src/certbot/plugins/nginx.py | .py | """Despite being public API, this is only meant for use in our certbot-nginx plugin, and isn't
intended for public use."""
from certbot._internal.plugins.nginx import configurator
ENTRYPOINT = configurator.NginxConfigurator
| 8 | 227 |
certbot | certbot/src/certbot/plugins/enhancements.py | .py | """New interface style Certbot enhancements"""
import abc
from typing import Any
from typing import Callable
from typing import Generator
from typing import Iterable
from typing import Optional
from certbot import configuration
from certbot import interfaces
from certbot._internal import constants
ENHANCEMENTS = ["re... | 191 | 6,761 |
certbot | certbot/src/certbot/plugins/util.py | .py | """Plugin utilities."""
import logging
from certbot import util
from certbot.compat import os
from certbot.compat.misc import STANDARD_BINARY_DIRS
logger = logging.getLogger(__name__)
def get_prefixes(path: str) -> list[str]:
"""Retrieves all possible path prefixes of a path, in descending order
of length. ... | 61 | 1,787 |
certbot | certbot/src/certbot/plugins/dns_common_lexicon.py | .py | """Common code for DNS Authenticator Plugins built on Lexicon."""
import abc
import logging
import sys
from types import ModuleType
from typing import Any
from typing import cast
from typing import Mapping
from typing import Optional
from typing import Union
import warnings
from requests.exceptions import HTTPError
fr... | 304 | 12,881 |
certbot | certbot/src/certbot/plugins/common.py | .py | """Plugin common functions."""
from abc import ABCMeta
from abc import abstractmethod
import argparse
import importlib.resources
import logging
import re
import shutil
import tempfile
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Optional
from typing import TypeVar
f... | 465 | 17,268 |
certbot | certbot/src/certbot/plugins/dns_test_common.py | .py | """Base test class for DNS authenticators."""
from typing import Any
from typing import Mapping
from typing import Protocol
from unittest import mock
import configobj
import josepy as jose
from acme import challenges, messages
from certbot import achallenges
from certbot.compat import filesystem
from certbot.plugins.... | 87 | 2,722 |
certbot | certbot/src/certbot/plugins/dns_common.py | .py | """Common code for DNS Authenticator Plugins."""
import abc
import logging
from time import sleep
from typing import Callable
from typing import Iterable
from typing import Mapping
from typing import Optional
import configobj
from acme import challenges
from certbot import achallenges
from certbot import configuratio... | 370 | 14,323 |
certbot | certbot/src/certbot/_internal/account.py | .py | """Creates ACME accounts for server."""
import datetime
import functools
import hashlib
import logging
import shutil
import socket
from typing import Any
from typing import Callable
from typing import cast
from typing import Mapping
from typing import Optional
from cryptography.hazmat.primitives import serialization
i... | 355 | 14,599 |
certbot | certbot/src/certbot/_internal/main.py | .py | """Certbot main entry point."""
# pylint: disable=too-many-lines
from contextlib import contextmanager
import copy
import functools
import logging.handlers
import sys
from typing import cast
from typing import Generator
from typing import IO
from typing import Iterable
from typing import Optional
from typing import Ty... | 1,890 | 75,390 |
certbot | certbot/src/certbot/_internal/san.py | .py | """Types for representing IP addresses and DNS names internal to Certbot."""
import ipaddress
from abc import abstractmethod
from typing import Any, Iterable
from acme import crypto_util as acme_crypto_util
from cryptography import x509
from certbot.util import enforce_domain_sanity
class SAN:
"""A domain or IP ... | 131 | 4,396 |
certbot | certbot/src/certbot/_internal/storage.py | .py | """Renewable certificates storage."""
# pylint: disable=too-many-lines
import datetime
import glob
import logging
import re
import shutil
import stat
from typing import Any
from typing import cast
from typing import Iterable
from typing import Mapping
from typing import Optional
from typing import Union
import configo... | 1,257 | 52,731 |
certbot | certbot/src/certbot/_internal/__init__.py | .py | """
Modules internal to Certbot.
This package contains modules that are not considered part of Certbot's public
API. They may be changed without updating Certbot's major version.
"""
| 7 | 184 |
certbot | certbot/src/certbot/_internal/hooks.py | .py | """Facilities for implementing hooks that call shell commands."""
import logging
from typing import Optional
from certbot import configuration
from certbot import errors
from certbot import util
from certbot._internal import san
from certbot.compat import filesystem
from certbot.compat import misc
from certbot.compat... | 278 | 10,018 |
certbot | certbot/src/certbot/_internal/updater.py | .py | """Updaters run at renewal"""
import logging
from certbot import configuration
from certbot import errors
from certbot import interfaces
from certbot._internal import storage
from certbot._internal.plugins import disco as plugin_disco
from certbot._internal.plugins import selection as plug_sel
from certbot.plugins imp... | 134 | 4,747 |
certbot | certbot/src/certbot/_internal/ocsp.py | .py | """Tools for checking certificate revocation."""
from datetime import datetime
from datetime import timedelta
from datetime import timezone
import logging
from typing import Optional
from cryptography import x509
from cryptography.exceptions import InvalidSignature
from cryptography.exceptions import UnsupportedAlgori... | 234 | 10,971 |
certbot | certbot/src/certbot/_internal/constants.py | .py | """Certbot constants."""
import atexit
import importlib.resources
import logging
from contextlib import ExitStack
from typing import Any
from acme import challenges
from certbot.compat import misc
from certbot.compat import os
SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins"
"""Setuptools entry point group name for... | 240 | 7,654 |
certbot | certbot/src/certbot/_internal/renewal.py | .py | """Functionality for autorenewal and associated juggling of configurations"""
import configobj
import copy
import datetime
import itertools
import logging
import random
import sys
import time
import traceback
from typing import Any
from typing import Iterable
from typing import Mapping
from typing import Optional
from ... | 762 | 33,317 |
certbot | certbot/src/certbot/_internal/client.py | .py | """Certbot client API."""
import datetime
import logging
import platform
from typing import Any
from typing import Callable
from typing import cast
from typing import IO
from typing import Optional
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitive... | 907 | 38,444 |
certbot | certbot/src/certbot/_internal/cert_manager.py | .py | """Tools for managing certificates."""
import datetime
import logging
import re
import traceback
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Optional
from typing import TypeVar
from typing import Union
from certbot import configuration
from certbot import crypto_ut... | 403 | 17,111 |
certbot | certbot/src/certbot/_internal/error_handler.py | .py | """Registers functions to be called if an exception or signal occurs."""
import functools
import logging
import signal
import traceback
from types import TracebackType
from typing import Any
from typing import Callable
from typing import Optional
from typing import Union
from certbot import errors
from certbot.compat ... | 178 | 7,379 |
certbot | certbot/src/certbot/_internal/log.py | .py | """Logging utilities for Certbot.
The best way to use this module is through `pre_arg_parse_setup` and
`post_arg_parse_setup`. `pre_arg_parse_setup` configures a minimal
terminal logger and ensures a detailed log is written to a secure
temporary file if Certbot exits before `post_arg_parse_setup` is called.
`post_arg_... | 404 | 15,397 |
certbot | certbot/src/certbot/_internal/auth_handler.py | .py | """ACME AuthHandler."""
import datetime
import logging
import time
from typing import Iterable
from typing import Optional
from typing import Sequence
import josepy
from requests.models import Response
from acme import challenges
from acme import client
from acme import errors as acme_errors
from acme import messages... | 483 | 21,351 |
certbot | certbot/src/certbot/_internal/snap_config.py | .py | """Module configuring Certbot in a snap environment"""
from __future__ import annotations
import logging
import socket
from typing import Iterable
from typing import Optional
from typing import Union
from requests import PreparedRequest, Session
from requests.adapters import HTTPAdapter
from requests.exceptions import... | 148 | 6,076 |
certbot | certbot/src/certbot/_internal/lock.py | .py | """Implements file locks compatible with Linux and Windows for locking files and directories."""
import errno
import logging
from typing import Optional
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
try:
import fcntl
except ImportError:
import msvcrt
POSIX_... | 260 | 10,191 |
certbot | certbot/src/certbot/_internal/eff.py | .py | """Subscribes users to the EFF newsletter."""
import logging
from typing import Optional
import requests
from certbot import configuration
from certbot._internal import constants
from certbot._internal.account import Account
from certbot._internal.account import AccountFileStorage
from certbot.display import util as ... | 128 | 4,484 |
certbot | certbot/src/certbot/_internal/display/dummy_readline.py | .py | """A dummy module with no effect for use on systems without readline."""
from typing import Callable
from typing import Iterable
from typing import Optional
def get_completer() -> Optional[Callable[[], str]]:
"""An empty implementation of readline.get_completer."""
def get_completer_delims() -> list[str]:
"... | 26 | 787 |
certbot | certbot/src/certbot/_internal/display/completer.py | .py | """Provides Tab completion when prompting users for a path."""
import glob
from types import TracebackType
from typing import Callable
from typing import Iterator
from typing import Literal
from typing import Optional
# readline module is not available on all systems
try:
import readline
except ImportError:
im... | 73 | 2,554 |
certbot | certbot/src/certbot/_internal/display/util.py | .py | """Internal Certbot display utilities."""
import sys
import textwrap
from typing import Optional
from acme import messages as acme_messages
from certbot._internal import san
from certbot.compat import misc
def wrap_lines(msg: str) -> str:
"""Format lines nicely to 80 chars.
:param str msg: Original message
... | 124 | 3,443 |
certbot | certbot/src/certbot/_internal/display/obj.py | .py | """This modules define the actual display implementations used in Certbot"""
import logging
import sys
from typing import Any
from typing import Iterable
from typing import Optional
from typing import TextIO
from typing import TypeVar
from typing import Union
from certbot import errors
from certbot._internal import co... | 567 | 22,531 |
certbot | certbot/src/certbot/_internal/tests/renewal_test.py | .py | """Tests for certbot._internal.renewal"""
import copy
import datetime
import sys
import tempfile
import unittest
from unittest import mock
import configobj
import pytest
from acme import challenges, errors as acme_errors
from certbot import configuration
from certbot import errors
from certbot._internal import storag... | 699 | 34,347 |
certbot | certbot/src/certbot/_internal/tests/san_test.py | .py | """Tests for the san module"""
import ipaddress
from datetime import datetime
import pytest
import unittest
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from certbot._internal import ... | 153 | 6,372 |
certbot | certbot/src/certbot/_internal/tests/hook_test.py | .py | """Tests for certbot._internal.hooks."""
import sys
import unittest
from platform import python_version_tuple
from unittest import mock
import pytest
from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util
de... | 469 | 16,910 |
certbot | certbot/src/certbot/_internal/tests/account_test.py | .py | """Tests for certbot._internal.account."""
import datetime
import sys
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import messages
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import misc
from certbot.compat import os
import certbot.te... | 337 | 14,290 |
certbot | certbot/src/certbot/_internal/tests/errors_test.py | .py | """Tests for certbot.errors."""
import sys
import unittest
from unittest import mock
import pytest
from acme import messages
from certbot import achallenges
from certbot.tests import acme_util
class FailedChallengesTest(unittest.TestCase):
"""Tests for certbot.errors.FailedChallenges."""
def setUp(self):
... | 61 | 2,102 |
certbot | certbot/src/certbot/_internal/tests/cert_manager_test.py | .py |
"""Tests for certbot._internal.cert_manager."""
# pylint: disable=protected-access
import re
import shutil
import sys
import tempfile
import unittest
from unittest import mock
import configobj
import pytest
from certbot import configuration
from certbot import errors
from certbot._internal import san
from certbot._i... | 587 | 25,931 |
certbot | certbot/src/certbot/_internal/tests/helpful_test.py | .py | """Tests for certbot.helpful_parser"""
import sys
import pytest
from certbot._internal.cli import HelpfulArgumentParser
class TestScanningFlags:
'''Test the prescan_for_flag method of HelpfulArgumentParser'''
def test_prescan_no_help_flag(self):
arg_parser = HelpfulArgumentParser(['run'], {})
... | 118 | 4,983 |
certbot | certbot/src/certbot/_internal/tests/util_test.py | .py | """Tests for certbot.util."""
import argparse
import errno
from importlib import reload as reload_module
import io
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
import certbot.tests.util as test_util
... | 710 | 24,762 |
certbot | certbot/src/certbot/_internal/tests/auth_handler_test.py | .py | """Tests for certbot._internal.auth_handler."""
import datetime
import logging
import sys
import unittest
from unittest import mock
from josepy import b64encode
import pytest
from acme import challenges
from acme import client as acme_client
from acme import errors as acme_errors
from acme import messages
from certbo... | 582 | 25,206 |
certbot | certbot/src/certbot/_internal/tests/storage_test.py | .py | """Tests for certbot._internal.storage."""
# pylint disable=protected-access
import datetime
import shutil
import stat
import sys
import unittest
from unittest import mock
import zoneinfo
import configobj
import pytest
import certbot
from certbot import errors
from certbot._internal.storage import ALL_FOUR
from certb... | 914 | 41,487 |
certbot | certbot/src/certbot/_internal/tests/lock_test.py | .py | """Tests for certbot._internal.lock."""
import functools
import importlib
import multiprocessing
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import os
from certbot.tests import util as test_util
if importlib.util.find_spec('fcntl'):
POSIX_MODE = True
else:
... | 142 | 5,010 |
certbot | certbot/src/certbot/_internal/tests/reverter_test.py | .py | """Test certbot.reverter."""
import csv
import logging
import shutil
import sys
import tempfile
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import os
from certbot.tests import util as test_util
class ReverterCheckpointLocalTest(test_util.ConfigTestCase):
"""Test the Re... | 455 | 16,983 |
certbot | certbot/src/certbot/_internal/tests/crypto_util_test.py | .py | """Tests for certbot.crypto_util."""
import logging
import re
import sys
import unittest
from unittest import mock
import pytest
from cryptography import x509
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.serializat... | 550 | 20,540 |
certbot | certbot/src/certbot/_internal/tests/client_test.py | .py | """Tests for certbot._internal.client."""
import contextlib
import datetime
import platform
import shutil
import sys
import tempfile
import unittest
from unittest import mock
from unittest.mock import MagicMock
from josepy import interfaces
import pytest
from certbot import errors
from certbot import util
from certbo... | 1,123 | 52,337 |
certbot | certbot/src/certbot/_internal/tests/log_test.py | .py | """Tests for certbot._internal.log."""
import io
import logging
import logging.handlers
import sys
import time
from typing import Optional
import unittest
from unittest import mock
import pytest
from acme import messages
from certbot import errors
from certbot import util
from certbot._internal import constants
from ... | 439 | 15,949 |
certbot | certbot/src/certbot/_internal/tests/eff_test.py | .py | """Tests for certbot._internal.eff."""
import datetime
import sys
import unittest
from unittest import mock
import josepy
import pytest
import requests
from acme import messages
from certbot._internal import account
from certbot._internal import constants
import certbot.tests.util as test_util
_KEY = josepy.JWKRSA.l... | 184 | 6,677 |
certbot | certbot/src/certbot/_internal/tests/cli_test.py | .py | """Tests for certbot._internal.cli."""
import argparse
import copy
import io
import sys
import tempfile
from typing import Any
import unittest
from unittest import mock
import pytest
from acme import challenges
from certbot import errors
from certbot.configuration import ArgumentSource, NamespaceConfig
from certbot._... | 612 | 26,590 |
certbot | certbot/src/certbot/_internal/tests/ocsp_test.py | .py | """Tests for ocsp.py"""
# pylint: disable=protected-access
import contextlib
from datetime import datetime
from datetime import timedelta
from datetime import timezone
import sys
import unittest
from unittest import mock
from cryptography import x509
from cryptography.exceptions import InvalidSignature
from cryptograp... | 250 | 12,646 |
certbot | certbot/src/certbot/_internal/tests/renewupdater_test.py | .py | """Tests for renewal updater interfaces"""
import sys
from unittest import mock
import pytest
from certbot import interfaces
from certbot._internal import main
from certbot._internal import updater
from certbot.plugins import enhancements
import certbot.tests.util as test_util
class RenewUpdaterTest(test_util.Confi... | 126 | 5,493 |
certbot | certbot/src/certbot/_internal/tests/error_handler_test.py | .py | """Tests for certbot._internal.error_handler."""
import contextlib
import signal
import sys
from typing import Callable
from typing import Union
import unittest
from unittest import mock
import pytest
from certbot.compat import os
def get_signals(signums):
"""Get the handlers for an iterable of signums."""
... | 155 | 5,178 |
certbot | certbot/src/certbot/_internal/tests/configuration_test.py | .py | """Tests for certbot.configuration."""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot._internal import constants
from certbot.compat import misc
from certbot.compat import os
from certbot.tests import util as test_util
class NamespaceConfigTest(test_util.ConfigTestCase):
... | 172 | 7,126 |
certbot | certbot/src/certbot/_internal/tests/main_test.py | .py | # coding=utf-8
"""Tests for certbot._internal.main."""
# pylint: disable=too-many-lines
import contextlib
import datetime
from importlib import reload as reload_module
import io
import itertools
import json
import shutil
import sys
import tempfile
import traceback
import unittest
from unittest import mock
import confi... | 2,580 | 123,620 |
certbot | certbot/src/certbot/_internal/tests/display/obj_test.py | .py | """Test :mod:`certbot._internal.display.obj`."""
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot._internal.display import obj as display_obj
from certbot.display import util as display_util
CHOICES = [("First", "Description1"), ("Second", "Description2")]
TA... | 354 | 13,802 |
certbot | certbot/src/certbot/_internal/tests/display/util_test.py | .py | """Test :mod:`certbot.display.util`."""
import sys
import pytest
import certbot.tests.util as test_util
@test_util.patch_display_util()
def test_notify(mock_util):
from certbot.display.util import notify
notify("Hello World")
mock_util().notification.assert_called_with(
"Hello World", pause=Fals... | 75 | 2,282 |
certbot | certbot/src/certbot/_internal/tests/display/ops_test.py | .py | # coding=utf-8
"""Test certbot.display.ops."""
import sys
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import messages
from certbot import errors
from certbot._internal import account
from certbot._internal.display import obj as display_obj
from certbot.compat import filesys... | 510 | 19,750 |
certbot | certbot/src/certbot/_internal/tests/display/internal_util_test.py | .py | """Test :mod:`certbot._internal.display.util`."""
import io
import socket
import sys
import tempfile
import unittest
from unittest import mock
import pytest
from acme import messages as acme_messages
from certbot import errors
class WrapLinesTest(unittest.TestCase):
def test_wrap_lines(self):
from certb... | 154 | 5,125 |
certbot | certbot/src/certbot/_internal/tests/display/completer_test.py | .py | """Test certbot._internal.display.completer."""
from importlib import reload as reload_module
import string
import sys
import unittest
from unittest import mock
import pytest
from certbot.compat import filesystem
from certbot.compat import os
import certbot.tests.util as test_util
try:
import readline # pylint:... | 110 | 3,692 |
certbot | certbot/src/certbot/_internal/tests/compat/filesystem_test.py | .py | """Tests for certbot.compat.filesystem"""
import contextlib
import errno
import sys
import unittest
from unittest import mock
import pytest
from certbot import util
from certbot._internal import lock
from certbot.compat import filesystem
from certbot.compat import os
import certbot.tests.util as test_util
from certbo... | 685 | 27,388 |
certbot | certbot/src/certbot/_internal/tests/compat/os_test.py | .py | """Unit test for os module."""
import sys
import pytest
from certbot.compat import os
def test_forbidden_methods():
# Checks for os module
for method in ['chmod', 'chown', 'open', 'mkdir', 'makedirs', 'rename',
'replace', 'access', 'stat', 'fstat']:
with pytest.raises(RuntimeError... | 23 | 604 |
certbot | certbot/src/certbot/_internal/tests/compat/misc_test.py | .py | """Tests for certbot.compat.misc"""
import sys
from unittest import mock
import pytest
from certbot.compat import os
class ExecuteStatusTest:
"""Tests for certbot.compat.misc.execute_command_status."""
@classmethod
def _call(cls, *args, **kwargs):
from certbot.compat.misc import execute_command... | 49 | 1,747 |
certbot | certbot/src/certbot/_internal/tests/plugins/common_test.py | .py | """Tests for certbot.plugins.common."""
import functools
import shutil
import sys
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import challenges
from acme import messages
from certbot import achallenges
from certbot import crypto_util
from certbot import errors
from certbot.... | 375 | 14,519 |
certbot | certbot/src/certbot/_internal/tests/plugins/standalone_test.py | .py | """Tests for certbot._internal.plugins.standalone."""
import errno
import socket
import sys
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import challenges, messages
from acme import standalone as acme_standalone
from certbot import achallenges
from certbot import errors
from... | 189 | 6,675 |
certbot | certbot/src/certbot/_internal/tests/plugins/selection_test.py | .py | """Tests for letsencrypt.plugins.selection"""
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot import interfaces
from certbot._internal.display import obj as display_obj
from certbot._internal.plugins.disco import PluginsRegistry
from certbot.display import ut... | 275 | 9,889 |
certbot | certbot/src/certbot/_internal/tests/plugins/util_test.py | .py | """Tests for certbot.plugins.util."""
import sys
from unittest import mock
import pytest
from certbot.compat import os
def test_get_prefix():
from certbot.plugins.util import get_prefixes
assert get_prefixes('/a/b/c') == \
[os.path.normpath(path) for path in ['/a/b/c', '/a/b', '/a', '/']]
assert... | 41 | 1,511 |
certbot | certbot/src/certbot/_internal/tests/plugins/webroot_test.py | .py | """Tests for certbot._internal.plugins.webroot."""
from __future__ import print_function
import argparse
import errno
import json
import shutil
import sys
import tempfile
import unittest
from unittest import mock
import josepy as jose
import pytest
from acme import challenges, messages
from certbot import achalleng... | 415 | 17,872 |
certbot | certbot/src/certbot/_internal/tests/plugins/dns_common_test.py | .py | """Tests for certbot.plugins.dns_common."""
import collections
import logging
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot import util
from certbot.compat import os
from certbot.display import util as display_util
from certbot.plugins import dns_common
fr... | 238 | 8,522 |
certbot | certbot/src/certbot/_internal/tests/plugins/manual_test.py | .py | """Tests for certbot._internal.plugins.manual"""
import sys
import textwrap
from unittest import mock
import pytest
from acme import challenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot.tests import util as test_util... | 161 | 7,950 |
certbot | certbot/src/certbot/_internal/tests/plugins/storage_test.py | .py | """Tests for certbot.plugins.storage.PluginStorage"""
import json
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util
class PluginStorageTest(test_util.ConfigTestCase):
"""Te... | 119 | 5,445 |
certbot | certbot/src/certbot/_internal/tests/plugins/enhancements_test.py | .py | """Tests for new style enhancements"""
import sys
from unittest import mock
import pytest
from certbot._internal.plugins import null
from certbot.plugins import enhancements
import certbot.tests.util as test_util
class EnhancementTest(test_util.ConfigTestCase):
"""Tests for new style enhancements in certbot.plu... | 63 | 2,295 |
certbot | certbot/src/certbot/_internal/tests/plugins/disco_test.py | .py | """Tests for certbot._internal.plugins.disco."""
import functools
import string
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot import interfaces
from certbot._internal.plugins import null
from certbot._internal.plugins import standalone
from certbot._interna... | 305 | 11,394 |
certbot | certbot/src/certbot/_internal/tests/plugins/null_test.py | .py | """Tests for certbot._internal.plugins.null."""
import sys
import unittest
from unittest import mock
import pytest
class InstallerTest(unittest.TestCase):
"""Tests for certbot._internal.plugins.null.Installer."""
def setUp(self):
from certbot._internal.plugins.null import Installer
self.inst... | 24 | 674 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/http_01_test.py | .py | """Tests for certbot._internal.plugins.nginx.http_01"""
import sys
from unittest import mock
import josepy as jose
import pytest
from acme import challenges, messages
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot._internal.plugins.nginx.ob... | 239 | 10,740 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/obj_test.py | .py | """Test the helper objects in certbot._internal.plugins.nginx.obj."""
import itertools
import sys
import unittest
import pytest
class AddrTest(unittest.TestCase):
"""Test the Addr class."""
def setUp(self):
from certbot._internal.plugins.nginx.obj import Addr
self.addr1 = Addr.fromstring("192... | 235 | 9,710 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/__init__.py | .py | """certbot-nginx tests"""
import pytest
# Make sure we're only running these tests if our nginx plugin dependencies are installed
pytest.importorskip("pyparsing")
| 7 | 165 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/test_util.py | .py | """Common test utilities for the nginx plugin."""
import copy
import importlib.resources
import shutil
import tempfile
from contextlib import contextmanager
from unittest import mock
import josepy as jose
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests impo... | 129 | 4,777 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/parser_test.py | .py | """Tests for certbot._internal.plugins.nginx.parser."""
import glob
import re
import shutil
import sys
import pytest
from certbot import errors
from certbot.compat import os
from certbot._internal.plugins.nginx import nginxparser
from certbot._internal.plugins.nginx import obj
from certbot._internal.plugins.nginx imp... | 601 | 27,217 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/parser_obj_test.py | .py | # type: ignore
# As done in parser_obj.py, this module is not used for now, so we just skip
# type checking for the sake of simplicity.
""" Tests for functions and classes in parser_obj.py """
import sys
import unittest
from unittest import mock
import pytest
from certbot._internal.plugins.nginx.parser_obj import CO... | 280 | 11,715 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/configurator_test.py | .py | """Test for certbot._internal.plugins.nginx.configurator."""
import sys
from unittest import mock
import pytest
from acme import challenges
from acme import messages
from certbot import achallenges
from certbot import crypto_util
from certbot import errors
from certbot.compat import os
from certbot.tests import util ... | 1,178 | 54,249 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/display_ops_test.py | .py | """Test certbot._internal.plugins.nginx.display_ops."""
import sys
import pytest
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot._internal.plugins.nginx import parser
from certbot._internal.plugins.nginx.display_ops import select_vhost_multiple
from certbot... | 46 | 1,656 |
certbot | certbot/src/certbot/_internal/tests/plugins/nginx/nginxparser_test.py | .py | """Test for certbot._internal.plugins.nginx.nginxparser."""
import copy
import operator
import sys
import tempfile
import unittest
from pyparsing import ParseException
import pytest
from certbot._internal.plugins.nginx.nginxparser import dump
from certbot._internal.plugins.nginx.nginxparser import dumps
from certbot.... | 527 | 19,292 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.