mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
* Work in progress * Work in progress * Work in progress * Work in progress * Fix issues around nullability of VirtualHost.path, may discuss that during review * Work in progress * Fix remaining types * Various lint fixes * Reconfigure tox and mypy to disallow untyped defs globally * Cleanup compatibility tests * Use cast for unused v2 logic * Improve types * Remove unused comment * Fix coverage * Better types * Fix another type * Update certbot-apache/certbot_apache/_internal/apacheparser.py Co-authored-by: alexzorin <alex@zor.io> * Update certbot-apache/certbot_apache/_internal/assertions.py Co-authored-by: alexzorin <alex@zor.io> * Fix type * Various fixes * Refactor imports * Keep naming convention consistent on TypeVars * Improve types * Improve types * Remove remaining Sequence[str] in the project Co-authored-by: alexzorin <alex@zor.io>
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
"""Certbot compatibility test interfaces"""
|
|
from abc import ABCMeta
|
|
from abc import abstractmethod
|
|
import argparse
|
|
from typing import cast
|
|
from typing import Set
|
|
|
|
from certbot import interfaces
|
|
from certbot.configuration import NamespaceConfig
|
|
|
|
|
|
class PluginProxy(interfaces.Plugin, metaclass=ABCMeta):
|
|
"""Wraps a Certbot plugin"""
|
|
|
|
http_port: int = NotImplemented
|
|
"""The port to connect to on localhost for HTTP traffic"""
|
|
|
|
https_port: int = NotImplemented
|
|
"""The port to connect to on localhost for HTTPS traffic"""
|
|
|
|
@classmethod
|
|
@abstractmethod
|
|
def add_parser_arguments(cls, parser: argparse.ArgumentParser) -> None:
|
|
"""Adds command line arguments needed by the parser"""
|
|
|
|
@abstractmethod
|
|
def __init__(self, args: argparse.Namespace) -> None:
|
|
"""Initializes the plugin with the given command line args"""
|
|
super().__init__(cast(NamespaceConfig, args), 'proxy')
|
|
|
|
@abstractmethod
|
|
def cleanup_from_tests(self) -> None:
|
|
"""Performs any necessary cleanup from running plugin tests.
|
|
|
|
This is guaranteed to be called before the program exits.
|
|
|
|
"""
|
|
|
|
@abstractmethod
|
|
def has_more_configs(self) -> bool:
|
|
"""Returns True if there are more configs to test"""
|
|
|
|
@abstractmethod
|
|
def load_config(self) -> str:
|
|
"""Loads the next config and returns its name"""
|
|
|
|
@abstractmethod
|
|
def get_testable_domain_names(self) -> Set[str]:
|
|
"""Returns the domain names that can be used in testing"""
|
|
|
|
|
|
class AuthenticatorProxy(PluginProxy, interfaces.Authenticator, metaclass=ABCMeta):
|
|
"""Wraps a Certbot authenticator"""
|
|
|
|
|
|
class InstallerProxy(PluginProxy, interfaces.Installer, metaclass=ABCMeta):
|
|
"""Wraps a Certbot installer"""
|
|
|
|
@abstractmethod
|
|
def get_all_names_answer(self) -> Set[str]:
|
|
"""Returns all names that should be found by the installer"""
|
|
|
|
|
|
class ConfiguratorProxy(AuthenticatorProxy, InstallerProxy, metaclass=ABCMeta):
|
|
"""Wraps a Certbot configurator"""
|