certbot/certbot-compatibility-test/certbot_compatibility_test/interfaces.py

66 lines
1.9 KiB
Python
Raw Permalink Normal View History

"""Certbot compatibility test interfaces"""
from abc import ABCMeta
from abc import abstractmethod
2015-07-14 21:04:43 -04:00
from certbot import interfaces
2015-07-14 21:04:43 -04:00
2015-07-22 21:31:26 -04:00
class PluginProxy(interfaces.Plugin, metaclass=ABCMeta):
"""Wraps a Certbot plugin"""
http_port: int = NotImplemented
"""The port to connect to on localhost for HTTP traffic"""
2015-08-03 14:38:22 -04:00
https_port: int = NotImplemented
"""The port to connect to on localhost for HTTPS traffic"""
2015-08-03 14:38:22 -04:00
@classmethod
@abstractmethod
2015-07-22 21:31:26 -04:00
def add_parser_arguments(cls, parser):
2015-07-14 21:04:43 -04:00
"""Adds command line arguments needed by the parser"""
@abstractmethod
def __init__(self, args):
2015-07-14 21:04:43 -04:00
"""Initializes the plugin with the given command line args"""
super().__init__(args, 'proxy')
2015-07-14 21:04:43 -04:00
@abstractmethod
def cleanup_from_tests(self):
2015-07-14 21:04:43 -04:00
"""Performs any necessary cleanup from running plugin tests.
2015-09-05 22:35:34 -04:00
This is guaranteed to be called before the program exits.
2015-07-14 21:04:43 -04:00
"""
@abstractmethod
def has_more_configs(self):
2015-07-14 21:04:43 -04:00
"""Returns True if there are more configs to test"""
@abstractmethod
def load_config(self):
2015-07-17 19:21:17 -04:00
"""Loads the next config and returns its name"""
2015-07-14 21:04:43 -04:00
@abstractmethod
def get_testable_domain_names(self):
2015-07-17 19:21:17 -04:00
"""Returns the domain names that can be used in testing"""
2015-07-14 21:04:43 -04:00
class AuthenticatorProxy(PluginProxy, interfaces.Authenticator, metaclass=ABCMeta):
"""Wraps a Certbot authenticator"""
2015-07-14 21:04:43 -04:00
class InstallerProxy(PluginProxy, interfaces.Installer, metaclass=ABCMeta):
"""Wraps a Certbot installer"""
2015-07-14 21:04:43 -04:00
@abstractmethod
def get_all_names_answer(self):
2015-07-17 19:21:17 -04:00
"""Returns all names that should be found by the installer"""
2015-07-14 21:04:43 -04:00
class ConfiguratorProxy(AuthenticatorProxy, InstallerProxy, metaclass=ABCMeta):
"""Wraps a Certbot configurator"""
class Configurator(interfaces.Installer, interfaces.Authenticator, metaclass=ABCMeta):
"""Represents a plugin that has both Installer and Authenticator capabilities"""