mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:14:54 +02:00
Enable Py36 Tests (#3972)
* add py36 to tox * Add Python 3.6 tests to Travis * Provide real path to python stdlib during tests * set logs_dir in config_test * set *_dirs in DetermineAccountTest * Fix TLSSNI01Test * Fix RenewalTest * fix test_ancient_webroot_renewal_conf
This commit is contained in:
@@ -87,6 +87,8 @@ matrix:
|
|||||||
env: TOXENV=py34
|
env: TOXENV=py34
|
||||||
- python: "3.5"
|
- python: "3.5"
|
||||||
env: TOXENV=py35
|
env: TOXENV=py35
|
||||||
|
- python: "3.6"
|
||||||
|
env: TOXENV=py36
|
||||||
- python: "2.7"
|
- python: "2.7"
|
||||||
env: TOXENV=nginxroundtrip
|
env: TOXENV=nginxroundtrip
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
"""Tests for certbot.plugins.common."""
|
"""Tests for certbot.plugins.common."""
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
@@ -170,8 +173,16 @@ class TLSSNI01Test(unittest.TestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self.tempdir = tempfile.mkdtemp()
|
||||||
|
configurator = mock.MagicMock()
|
||||||
|
configurator.config.config_dir = os.path.join(self.tempdir, "config")
|
||||||
|
configurator.config.work_dir = os.path.join(self.tempdir, "work")
|
||||||
|
|
||||||
from certbot.plugins.common import TLSSNI01
|
from certbot.plugins.common import TLSSNI01
|
||||||
self.sni = TLSSNI01(configurator=mock.MagicMock())
|
self.sni = TLSSNI01(configurator=configurator)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
shutil.rmtree(self.tempdir)
|
||||||
|
|
||||||
def test_add_chall(self):
|
def test_add_chall(self):
|
||||||
self.sni.add_chall(self.achalls[0], 0)
|
self.sni.add_chall(self.achalls[0], 0)
|
||||||
@@ -187,6 +198,7 @@ class TLSSNI01Test(unittest.TestCase):
|
|||||||
|
|
||||||
response = challenges.TLSSNI01Response()
|
response = challenges.TLSSNI01Response()
|
||||||
achall = mock.MagicMock()
|
achall = mock.MagicMock()
|
||||||
|
achall.chall.encode.return_value = "token"
|
||||||
key = test_util.load_pyopenssl_private_key("rsa512_key.pem")
|
key = test_util.load_pyopenssl_private_key("rsa512_key.pem")
|
||||||
achall.response_and_validation.return_value = (
|
achall.response_and_validation.return_value = (
|
||||||
response, (test_util.load_cert("cert.pem"), key))
|
response, (test_util.load_cert("cert.pem"), key))
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class NamespaceConfigTest(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.namespace = mock.MagicMock(
|
self.namespace = mock.MagicMock(
|
||||||
config_dir='/tmp/config', work_dir='/tmp/foo', foo='bar',
|
config_dir='/tmp/config', work_dir='/tmp/foo',
|
||||||
|
logs_dir="/tmp/bar", foo='bar',
|
||||||
server='https://acme-server.org:443/new',
|
server='https://acme-server.org:443/new',
|
||||||
tls_sni_01_port=1234, http01_port=4321)
|
tls_sni_01_port=1234, http01_port=4321)
|
||||||
from certbot.configuration import NamespaceConfig
|
from certbot.configuration import NamespaceConfig
|
||||||
|
|||||||
@@ -363,6 +363,9 @@ class DetermineAccountTest(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.args = mock.MagicMock(account=None, email=None,
|
self.args = mock.MagicMock(account=None, email=None,
|
||||||
|
config_dir="unused_config",
|
||||||
|
logs_dir="unused_logs",
|
||||||
|
work_dir="unused_work",
|
||||||
register_unsafely_without_email=False)
|
register_unsafely_without_email=False)
|
||||||
self.config = configuration.NamespaceConfig(self.args)
|
self.config = configuration.NamespaceConfig(self.args)
|
||||||
self.accs = [mock.MagicMock(id='x'), mock.MagicMock(id='y')]
|
self.accs = [mock.MagicMock(id='x'), mock.MagicMock(id='y')]
|
||||||
@@ -883,7 +886,9 @@ class MainTest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
|||||||
def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
|
def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
rc_path = test_util.make_lineage(self, 'sample-renewal-ancient.conf')
|
rc_path = test_util.make_lineage(self, 'sample-renewal-ancient.conf')
|
||||||
args = mock.MagicMock(account=None, email=None, webroot_path=None)
|
args = mock.MagicMock(account=None, config_dir=self.config_dir,
|
||||||
|
logs_dir=self.logs_dir, work_dir=self.work_dir,
|
||||||
|
email=None, webroot_path=None)
|
||||||
config = configuration.NamespaceConfig(args)
|
config = configuration.NamespaceConfig(args)
|
||||||
lineage = storage.RenewableCert(rc_path, config)
|
lineage = storage.RenewableCert(rc_path, config)
|
||||||
renewalparams = lineage.configuration["renewalparams"]
|
renewalparams = lineage.configuration["renewalparams"]
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import mock
|
import mock
|
||||||
import unittest
|
import unittest
|
||||||
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from certbot import configuration
|
from certbot import configuration
|
||||||
@@ -16,11 +17,16 @@ class RenewalTest(unittest.TestCase):
|
|||||||
self.tmp_dir = tempfile.mkdtemp()
|
self.tmp_dir = tempfile.mkdtemp()
|
||||||
self.config_dir = os.path.join(self.tmp_dir, 'config')
|
self.config_dir = os.path.join(self.tmp_dir, 'config')
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
shutil.rmtree(self.tmp_dir)
|
||||||
|
|
||||||
@mock.patch('certbot.cli.set_by_cli')
|
@mock.patch('certbot.cli.set_by_cli')
|
||||||
def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
|
def test_ancient_webroot_renewal_conf(self, mock_set_by_cli):
|
||||||
mock_set_by_cli.return_value = False
|
mock_set_by_cli.return_value = False
|
||||||
rc_path = util.make_lineage(self, 'sample-renewal-ancient.conf')
|
rc_path = util.make_lineage(self, 'sample-renewal-ancient.conf')
|
||||||
args = mock.MagicMock(account=None, email=None, webroot_path=None)
|
args = mock.MagicMock(account=None, config_dir=self.config_dir,
|
||||||
|
logs_dir="logs", work_dir="work",
|
||||||
|
email=None, webroot_path=None)
|
||||||
config = configuration.NamespaceConfig(args)
|
config = configuration.NamespaceConfig(args)
|
||||||
lineage = storage.RenewableCert(rc_path, config)
|
lineage = storage.RenewableCert(rc_path, config)
|
||||||
renewalparams = lineage.configuration['renewalparams']
|
renewalparams = lineage.configuration['renewalparams']
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
skipsdist = true
|
skipsdist = true
|
||||||
envlist = modification,py{26,33,34,35},cover,lint
|
envlist = modification,py{26,33,34,35,36},cover,lint
|
||||||
|
|
||||||
# nosetest -v => more verbose output, allows to detect busy waiting
|
# nosetest -v => more verbose output, allows to detect busy waiting
|
||||||
# loops, especially on Travis
|
# loops, especially on Travis
|
||||||
@@ -63,6 +63,13 @@ commands =
|
|||||||
pip install -e .[dev]
|
pip install -e .[dev]
|
||||||
nosetests -v certbot --processes=-1 --process-timeout=100
|
nosetests -v certbot --processes=-1 --process-timeout=100
|
||||||
|
|
||||||
|
[testenv:py36]
|
||||||
|
commands =
|
||||||
|
pip install -e acme[dns,dev]
|
||||||
|
nosetests -v acme --processes=-1
|
||||||
|
pip install -e .[dev]
|
||||||
|
nosetests -v certbot --processes=-1 --process-timeout=100
|
||||||
|
|
||||||
[testenv:py27_install]
|
[testenv:py27_install]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
commands =
|
commands =
|
||||||
|
|||||||
Reference in New Issue
Block a user