diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/dns_ovh.py python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/dns_ovh.py --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/dns_ovh.py 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/dns_ovh.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -"""DNS Authenticator for OVH DNS.""" -import logging - -import zope.interface -from lexicon.providers import ovh - -from certbot import errors -from certbot import interfaces -from certbot.plugins import dns_common -from certbot.plugins import dns_common_lexicon - -logger = logging.getLogger(__name__) - -TOKEN_URL = 'https://eu.api.ovh.com/createToken/ or https://ca.api.ovh.com/createToken/' - - -@zope.interface.implementer(interfaces.IAuthenticator) -@zope.interface.provider(interfaces.IPluginFactory) -class Authenticator(dns_common.DNSAuthenticator): - """DNS Authenticator for OVH - - This Authenticator uses the OVH API to fulfill a dns-01 challenge. - """ - - description = 'Obtain certificates using a DNS TXT record (if you are using OVH for DNS).' - ttl = 60 - - def __init__(self, *args, **kwargs): - super(Authenticator, self).__init__(*args, **kwargs) - self.credentials = None - - @classmethod - def add_parser_arguments(cls, add): # pylint: disable=arguments-differ - super(Authenticator, cls).add_parser_arguments(add, default_propagation_seconds=30) - add('credentials', help='OVH credentials INI file.') - - def more_info(self): # pylint: disable=missing-docstring,no-self-use - return 'This plugin configures a DNS TXT record to respond to a dns-01 challenge using ' + \ - 'the OVH API.' - - def _setup_credentials(self): - self.credentials = self._configure_credentials( - 'credentials', - 'OVH credentials INI file', - { - 'endpoint': 'OVH API endpoint (ovh-eu or ovh-ca)', - 'application-key': 'Application key for OVH API, obtained from {0}' - .format(TOKEN_URL), - 'application-secret': 'Application secret for OVH API, obtained from {0}' - .format(TOKEN_URL), - 'consumer-key': 'Consumer key for OVH API, obtained from {0}' - .format(TOKEN_URL), - } - ) - - def _perform(self, domain, validation_name, validation): - self._get_ovh_client().add_txt_record(domain, validation_name, validation) - - def _cleanup(self, domain, validation_name, validation): - self._get_ovh_client().del_txt_record(domain, validation_name, validation) - - def _get_ovh_client(self): - return _OVHLexiconClient( - self.credentials.conf('endpoint'), - self.credentials.conf('application-key'), - self.credentials.conf('application-secret'), - self.credentials.conf('consumer-key'), - self.ttl - ) - - -class _OVHLexiconClient(dns_common_lexicon.LexiconClient): - """ - Encapsulates all communication with the OVH API via Lexicon. - """ - - def __init__(self, endpoint, application_key, application_secret, consumer_key, ttl): - super(_OVHLexiconClient, self).__init__() - - config = dns_common_lexicon.build_lexicon_config('ovh', { - 'ttl': ttl, - }, { - 'auth_entrypoint': endpoint, - 'auth_application_key': application_key, - 'auth_application_secret': application_secret, - 'auth_consumer_key': consumer_key, - }) - - self.provider = ovh.Provider(config) - - def _handle_http_error(self, e, domain_name): - hint = None - if str(e).startswith('400 Client Error:'): - hint = 'Is your Application Secret value correct?' - if str(e).startswith('403 Client Error:'): - hint = 'Are your Application Key and Consumer Key values correct?' - - return errors.PluginError('Error determining zone identifier for {0}: {1}.{2}' - .format(domain_name, e, ' ({0})'.format(hint) if hint else '')) - - def _handle_general_error(self, e, domain_name): - if domain_name in str(e) and str(e).endswith('not found'): - return - - super(_OVHLexiconClient, self)._handle_general_error(e, domain_name) diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/dns_ovh_test.py python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/dns_ovh_test.py --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/dns_ovh_test.py 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/dns_ovh_test.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -"""Tests for certbot_dns_ovh.dns_ovh.""" - -import os -import unittest - -import mock -from requests.exceptions import HTTPError - -from certbot.plugins import dns_test_common -from certbot.plugins import dns_test_common_lexicon -from certbot.tests import util as test_util - -ENDPOINT = 'ovh-eu' -APPLICATION_KEY = 'foo' -APPLICATION_SECRET = 'bar' -CONSUMER_KEY = 'spam' - - -class AuthenticatorTest(test_util.TempDirTestCase, - dns_test_common_lexicon.BaseLexiconAuthenticatorTest): - - def setUp(self): - super(AuthenticatorTest, self).setUp() - - from certbot_dns_ovh.dns_ovh import Authenticator - - path = os.path.join(self.tempdir, 'file.ini') - credentials = { - "ovh_endpoint": ENDPOINT, - "ovh_application_key": APPLICATION_KEY, - "ovh_application_secret": APPLICATION_SECRET, - "ovh_consumer_key": CONSUMER_KEY, - } - dns_test_common.write(credentials, path) - - self.config = mock.MagicMock(ovh_credentials=path, - ovh_propagation_seconds=0) # don't wait during tests - - self.auth = Authenticator(self.config, "ovh") - - self.mock_client = mock.MagicMock() - # _get_ovh_client | pylint: disable=protected-access - self.auth._get_ovh_client = mock.MagicMock(return_value=self.mock_client) - - -class OVHLexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest): - DOMAIN_NOT_FOUND = Exception('Domain example.com not found') - LOGIN_ERROR = HTTPError('403 Client Error: Forbidden for url: https://eu.api.ovh.com/1.0/...') - - def setUp(self): - from certbot_dns_ovh.dns_ovh import _OVHLexiconClient - - self.client = _OVHLexiconClient( - ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY, 0 - ) - - self.provider_mock = mock.MagicMock() - self.client.provider = self.provider_mock - - -if __name__ == "__main__": - unittest.main() # pragma: no cover diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/_internal/dns_ovh.py python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/_internal/dns_ovh.py --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/_internal/dns_ovh.py 1970-01-01 00:00:00.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/_internal/dns_ovh.py 2020-03-03 20:36:36.000000000 +0000 @@ -0,0 +1,105 @@ +"""DNS Authenticator for OVH DNS.""" +import logging + +from lexicon.providers import ovh +import zope.interface + +from certbot import errors +from certbot import interfaces +from certbot.plugins import dns_common +from certbot.plugins import dns_common_lexicon + +logger = logging.getLogger(__name__) + +TOKEN_URL = 'https://eu.api.ovh.com/createToken/ or https://ca.api.ovh.com/createToken/' + + +@zope.interface.implementer(interfaces.IAuthenticator) +@zope.interface.provider(interfaces.IPluginFactory) +class Authenticator(dns_common.DNSAuthenticator): + """DNS Authenticator for OVH + + This Authenticator uses the OVH API to fulfill a dns-01 challenge. + """ + + description = 'Obtain certificates using a DNS TXT record (if you are using OVH for DNS).' + ttl = 60 + + def __init__(self, *args, **kwargs): + super(Authenticator, self).__init__(*args, **kwargs) + self.credentials = None + + @classmethod + def add_parser_arguments(cls, add): # pylint: disable=arguments-differ + super(Authenticator, cls).add_parser_arguments(add, default_propagation_seconds=30) + add('credentials', help='OVH credentials INI file.') + + def more_info(self): # pylint: disable=missing-function-docstring + return 'This plugin configures a DNS TXT record to respond to a dns-01 challenge using ' + \ + 'the OVH API.' + + def _setup_credentials(self): + self.credentials = self._configure_credentials( + 'credentials', + 'OVH credentials INI file', + { + 'endpoint': 'OVH API endpoint (ovh-eu or ovh-ca)', + 'application-key': 'Application key for OVH API, obtained from {0}' + .format(TOKEN_URL), + 'application-secret': 'Application secret for OVH API, obtained from {0}' + .format(TOKEN_URL), + 'consumer-key': 'Consumer key for OVH API, obtained from {0}' + .format(TOKEN_URL), + } + ) + + def _perform(self, domain, validation_name, validation): + self._get_ovh_client().add_txt_record(domain, validation_name, validation) + + def _cleanup(self, domain, validation_name, validation): + self._get_ovh_client().del_txt_record(domain, validation_name, validation) + + def _get_ovh_client(self): + return _OVHLexiconClient( + self.credentials.conf('endpoint'), + self.credentials.conf('application-key'), + self.credentials.conf('application-secret'), + self.credentials.conf('consumer-key'), + self.ttl + ) + + +class _OVHLexiconClient(dns_common_lexicon.LexiconClient): + """ + Encapsulates all communication with the OVH API via Lexicon. + """ + + def __init__(self, endpoint, application_key, application_secret, consumer_key, ttl): + super(_OVHLexiconClient, self).__init__() + + config = dns_common_lexicon.build_lexicon_config('ovh', { + 'ttl': ttl, + }, { + 'auth_entrypoint': endpoint, + 'auth_application_key': application_key, + 'auth_application_secret': application_secret, + 'auth_consumer_key': consumer_key, + }) + + self.provider = ovh.Provider(config) + + def _handle_http_error(self, e, domain_name): + hint = None + if str(e).startswith('400 Client Error:'): + hint = 'Is your Application Secret value correct?' + if str(e).startswith('403 Client Error:'): + hint = 'Are your Application Key and Consumer Key values correct?' + + return errors.PluginError('Error determining zone identifier for {0}: {1}.{2}' + .format(domain_name, e, ' ({0})'.format(hint) if hint else '')) + + def _handle_general_error(self, e, domain_name): + if domain_name in str(e) and str(e).endswith('not found'): + return + + super(_OVHLexiconClient, self)._handle_general_error(e, domain_name) diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/_internal/__init__.py python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/_internal/__init__.py --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh/_internal/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh/_internal/__init__.py 2020-03-03 20:36:36.000000000 +0000 @@ -0,0 +1 @@ +"""Internal implementation of `~certbot_dns_ovh.dns_ovh` plugin.""" diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/entry_points.txt python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/entry_points.txt --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/entry_points.txt 2019-02-07 21:21:11.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/entry_points.txt 2020-03-03 20:37:14.000000000 +0000 @@ -1,3 +1,3 @@ [certbot.plugins] -dns-ovh = certbot_dns_ovh.dns_ovh:Authenticator +dns-ovh = certbot_dns_ovh._internal.dns_ovh:Authenticator diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/PKG-INFO python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/PKG-INFO --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/PKG-INFO 2019-02-07 21:21:11.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/PKG-INFO 2020-03-03 20:37:14.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: certbot-dns-ovh -Version: 0.31.0 +Version: 1.3.0 Summary: OVH DNS Authenticator plugin for Certbot Home-page: https://github.com/certbot/certbot Author: Certbot Project @@ -8,7 +8,7 @@ License: Apache License 2.0 Description: UNKNOWN Platform: UNKNOWN -Classifier: Development Status :: 3 - Alpha +Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Plugins Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License @@ -17,14 +17,15 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Security Classifier: Topic :: System :: Installation/Setup Classifier: Topic :: System :: Networking Classifier: Topic :: System :: Systems Administration Classifier: Topic :: Utilities -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* Provides-Extra: docs diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/requires.txt python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/requires.txt --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/requires.txt 2019-02-07 21:21:11.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/requires.txt 2020-03-03 20:37:14.000000000 +0000 @@ -1,5 +1,5 @@ acme>=0.31.0 -certbot>=0.31.0 +certbot>=1.1.0 dns-lexicon>=2.7.14 mock setuptools diff -Nru python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/SOURCES.txt python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/SOURCES.txt --- python-certbot-dns-ovh-0.31.0/certbot_dns_ovh.egg-info/SOURCES.txt 2019-02-07 21:21:11.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/certbot_dns_ovh.egg-info/SOURCES.txt 2020-03-03 20:37:14.000000000 +0000 @@ -4,18 +4,18 @@ setup.cfg setup.py certbot_dns_ovh/__init__.py -certbot_dns_ovh/dns_ovh.py -certbot_dns_ovh/dns_ovh_test.py certbot_dns_ovh.egg-info/PKG-INFO certbot_dns_ovh.egg-info/SOURCES.txt certbot_dns_ovh.egg-info/dependency_links.txt certbot_dns_ovh.egg-info/entry_points.txt certbot_dns_ovh.egg-info/requires.txt certbot_dns_ovh.egg-info/top_level.txt +certbot_dns_ovh/_internal/__init__.py +certbot_dns_ovh/_internal/dns_ovh.py docs/.gitignore docs/Makefile docs/api.rst docs/conf.py docs/index.rst docs/make.bat -docs/api/dns_ovh.rst \ No newline at end of file +tests/dns_ovh_test.py \ No newline at end of file diff -Nru python-certbot-dns-ovh-0.31.0/debian/changelog python-certbot-dns-ovh-1.3.0/debian/changelog --- python-certbot-dns-ovh-0.31.0/debian/changelog 2019-02-10 01:19:23.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/debian/changelog 2020-04-28 00:07:02.000000000 +0000 @@ -1,3 +1,12 @@ +python-certbot-dns-ovh (1.3.0-1) unstable; urgency=medium + + * New upstream version 1.3.0 + * Switch to using Provides for API management + * Add dep on pytest + * Bump S-V, swiching to debhelper-compat + + -- Harlan Lieberman-Berg Mon, 27 Apr 2020 20:07:02 -0400 + python-certbot-dns-ovh (0.31.0-1) unstable; urgency=medium * New upstream version 0.31.0 diff -Nru python-certbot-dns-ovh-0.31.0/debian/compat python-certbot-dns-ovh-1.3.0/debian/compat --- python-certbot-dns-ovh-0.31.0/debian/compat 2018-09-06 01:06:05.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru python-certbot-dns-ovh-0.31.0/debian/control python-certbot-dns-ovh-1.3.0/debian/control --- python-certbot-dns-ovh-0.31.0/debian/control 2019-02-10 01:18:49.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/debian/control 2020-04-28 00:06:17.000000000 +0000 @@ -3,18 +3,19 @@ Uploaders: Harlan Lieberman-Berg Section: python Priority: optional -Build-Depends: debhelper (>= 11~), +Build-Depends: debhelper-compat (= 12), dh-python, python3, - python3-acme (>= 0.30.0~), - python3-certbot (>= 0.30.0~), + python3-acme-abi-1, + python3-certbot-abi-1 (>= 1.1), python3-lexicon (>= 2.7.14~), python3-mock, + python3-pytest, python3-setuptools (>= 1.0), python3-sphinx (>= 1.3.1-1~), python3-sphinx-rtd-theme, python3-zope.interface -Standards-Version: 4.3.0 +Standards-Version: 4.5.0 Homepage: https://certbot.eff.org/ Vcs-Git: https://salsa.debian.org/letsencrypt-team/certbot/certbot-dns-ovh.git Vcs-Browser: https://salsa.debian.org/letsencrypt-team/certbot/certbot-dns-ovh @@ -23,7 +24,9 @@ Package: python3-certbot-dns-ovh Architecture: all -Depends: ${python3:Depends}, +Depends: certbot, + python3-certbot-abi-1 (>= 1.1), + ${python3:Depends}, ${misc:Depends} Enhances: certbot Description: OVH DNS plugin for Certbot diff -Nru python-certbot-dns-ovh-0.31.0/docs/api/dns_ovh.rst python-certbot-dns-ovh-1.3.0/docs/api/dns_ovh.rst --- python-certbot-dns-ovh-0.31.0/docs/api/dns_ovh.rst 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/docs/api/dns_ovh.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -:mod:`certbot_dns_ovh.dns_ovh` ------------------------------- - -.. automodule:: certbot_dns_ovh.dns_ovh - :members: diff -Nru python-certbot-dns-ovh-0.31.0/docs/api.rst python-certbot-dns-ovh-1.3.0/docs/api.rst --- python-certbot-dns-ovh-0.31.0/docs/api.rst 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/docs/api.rst 2020-03-03 20:36:36.000000000 +0000 @@ -2,7 +2,4 @@ API Documentation ================= -.. toctree:: - :glob: - - api/** +Certbot plugins implement the Certbot plugins API, and do not otherwise have an external API. diff -Nru python-certbot-dns-ovh-0.31.0/docs/conf.py python-certbot-dns-ovh-1.3.0/docs/conf.py --- python-certbot-dns-ovh-0.31.0/docs/conf.py 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/docs/conf.py 2020-03-03 20:36:36.000000000 +0000 @@ -17,6 +17,7 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os + # import sys # sys.path.insert(0, os.path.abspath('.')) @@ -37,7 +38,7 @@ 'sphinx.ext.viewcode'] autodoc_member_order = 'bysource' -autodoc_default_flags = ['show-inheritance', 'private-members'] +autodoc_default_flags = ['show-inheritance'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -83,7 +84,7 @@ pygments_style = 'sphinx' # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True +todo_include_todos = False # -- Options for HTML output ---------------------------------------------- diff -Nru python-certbot-dns-ovh-0.31.0/MANIFEST.in python-certbot-dns-ovh-1.3.0/MANIFEST.in --- python-certbot-dns-ovh-0.31.0/MANIFEST.in 2019-02-07 21:20:29.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/MANIFEST.in 2020-03-03 20:36:36.000000000 +0000 @@ -1,3 +1,6 @@ include LICENSE.txt include README.rst recursive-include docs * +recursive-include tests * +global-exclude __pycache__ +global-exclude *.py[cod] diff -Nru python-certbot-dns-ovh-0.31.0/PKG-INFO python-certbot-dns-ovh-1.3.0/PKG-INFO --- python-certbot-dns-ovh-0.31.0/PKG-INFO 2019-02-07 21:21:11.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/PKG-INFO 2020-03-03 20:37:14.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: certbot-dns-ovh -Version: 0.31.0 +Version: 1.3.0 Summary: OVH DNS Authenticator plugin for Certbot Home-page: https://github.com/certbot/certbot Author: Certbot Project @@ -8,7 +8,7 @@ License: Apache License 2.0 Description: UNKNOWN Platform: UNKNOWN -Classifier: Development Status :: 3 - Alpha +Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Plugins Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License @@ -17,14 +17,15 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Security Classifier: Topic :: System :: Installation/Setup Classifier: Topic :: System :: Networking Classifier: Topic :: System :: Systems Administration Classifier: Topic :: Utilities -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* Provides-Extra: docs diff -Nru python-certbot-dns-ovh-0.31.0/setup.py python-certbot-dns-ovh-1.3.0/setup.py --- python-certbot-dns-ovh-0.31.0/setup.py 2019-02-07 21:20:31.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/setup.py 2020-03-03 20:36:38.000000000 +0000 @@ -1,14 +1,16 @@ -from setuptools import setup -from setuptools import find_packages +import sys +from setuptools import find_packages +from setuptools import setup +from setuptools.command.test import test as TestCommand -version = '0.31.0' +version = '1.3.0' # Remember to update local-oldest-requirements.txt when changing the minimum # acme/certbot version. install_requires = [ 'acme>=0.31.0', - 'certbot>=0.31.0', + 'certbot>=1.1.0', 'dns-lexicon>=2.7.14', # Correct proxy use on OVH provider 'mock', 'setuptools', @@ -20,6 +22,20 @@ 'sphinx_rtd_theme', ] +class PyTest(TestCommand): + user_options = [] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.pytest_args = '' + + def run_tests(self): + import shlex + # import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(shlex.split(self.pytest_args)) + sys.exit(errno) + setup( name='certbot-dns-ovh', version=version, @@ -28,9 +44,9 @@ author="Certbot Project", author_email='client-dev@letsencrypt.org', license='Apache License 2.0', - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', classifiers=[ - 'Development Status :: 3 - Alpha', + 'Development Status :: 5 - Production/Stable', 'Environment :: Plugins', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', @@ -39,9 +55,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Security', 'Topic :: System :: Installation/Setup', @@ -58,8 +75,10 @@ }, entry_points={ 'certbot.plugins': [ - 'dns-ovh = certbot_dns_ovh.dns_ovh:Authenticator', + 'dns-ovh = certbot_dns_ovh._internal.dns_ovh:Authenticator', ], }, + tests_require=["pytest"], test_suite='certbot_dns_ovh', + cmdclass={"test": PyTest}, ) diff -Nru python-certbot-dns-ovh-0.31.0/tests/dns_ovh_test.py python-certbot-dns-ovh-1.3.0/tests/dns_ovh_test.py --- python-certbot-dns-ovh-0.31.0/tests/dns_ovh_test.py 1970-01-01 00:00:00.000000000 +0000 +++ python-certbot-dns-ovh-1.3.0/tests/dns_ovh_test.py 2020-03-03 20:36:36.000000000 +0000 @@ -0,0 +1,62 @@ +"""Tests for certbot_dns_ovh._internal.dns_ovh.""" + +import unittest + +import mock +from requests.exceptions import HTTPError + +from certbot.compat import os +from certbot.plugins import dns_test_common +from certbot.plugins import dns_test_common_lexicon +from certbot.tests import util as test_util + +ENDPOINT = 'ovh-eu' +APPLICATION_KEY = 'foo' +APPLICATION_SECRET = 'bar' +CONSUMER_KEY = 'spam' + + +class AuthenticatorTest(test_util.TempDirTestCase, + dns_test_common_lexicon.BaseLexiconAuthenticatorTest): + + def setUp(self): + super(AuthenticatorTest, self).setUp() + + from certbot_dns_ovh._internal.dns_ovh import Authenticator + + path = os.path.join(self.tempdir, 'file.ini') + credentials = { + "ovh_endpoint": ENDPOINT, + "ovh_application_key": APPLICATION_KEY, + "ovh_application_secret": APPLICATION_SECRET, + "ovh_consumer_key": CONSUMER_KEY, + } + dns_test_common.write(credentials, path) + + self.config = mock.MagicMock(ovh_credentials=path, + ovh_propagation_seconds=0) # don't wait during tests + + self.auth = Authenticator(self.config, "ovh") + + self.mock_client = mock.MagicMock() + # _get_ovh_client | pylint: disable=protected-access + self.auth._get_ovh_client = mock.MagicMock(return_value=self.mock_client) + + +class OVHLexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest): + DOMAIN_NOT_FOUND = Exception('Domain example.com not found') + LOGIN_ERROR = HTTPError('403 Client Error: Forbidden for url: https://eu.api.ovh.com/1.0/...') + + def setUp(self): + from certbot_dns_ovh._internal.dns_ovh import _OVHLexiconClient + + self.client = _OVHLexiconClient( + ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY, 0 + ) + + self.provider_mock = mock.MagicMock() + self.client.provider = self.provider_mock + + +if __name__ == "__main__": + unittest.main() # pragma: no cover