Finished basic Apache test framework

This commit is contained in:
Brad Warren
2015-07-22 18:25:09 -07:00
parent b00a3cf963
commit c927f0c89a
10 changed files with 241 additions and 109 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ class DVSNI(DVChallenge):
kwargs["name"] = self.nonce_domain
# TODO: try different methods?
# pylint: disable=protected-access
return crypto_util._probe_sni(**kwargs)
return crypto_util.probe_sni(**kwargs)
@ChallengeResponse.register
+1 -1
View File
@@ -179,7 +179,7 @@ class DVSNITest(unittest.TestCase):
jose.DeserializationError, DVSNI.from_json, self.jmsg)
@mock.patch('acme.challenges.socket.gethostbyname')
@mock.patch('acme.challenges.crypto_util._probe_sni')
@mock.patch('acme.challenges.crypto_util.probe_sni')
def test_probe_cert(self, mock_probe_sni, mock_gethostbyname):
mock_gethostbyname.return_value = '127.0.0.1'
self.msg.probe_cert('foo.com')
+2 -2
View File
@@ -69,8 +69,8 @@ def _serve_sni(certs, sock, reuseaddr=True, method=_DEFAULT_DVSNI_SSL_METHOD,
raise errors.Error(error)
def _probe_sni(name, host, port=443, timeout=300,
method=_DEFAULT_DVSNI_SSL_METHOD, source_address=('0', 0)):
def probe_sni(name, host, port=443, timeout=300,
method=_DEFAULT_DVSNI_SSL_METHOD, source_address=('0', 0)):
"""Probe SNI server for SSL certificate.
:param bytes name: Byte string to send as the server name in the
+3 -3
View File
@@ -13,7 +13,7 @@ from acme import test_util
class ServeProbeSNITest(unittest.TestCase):
"""Tests for acme.crypto_util._serve_sni/_probe_sni."""
"""Tests for acme.crypto_util._serve_sni/probe_sni."""
def setUp(self):
self.cert = test_util.load_cert('cert.pem')
@@ -45,8 +45,8 @@ class ServeProbeSNITest(unittest.TestCase):
self.server.join()
def _probe(self, name):
from acme.crypto_util import _probe_sni
return jose.ComparableX509(_probe_sni(
from acme.crypto_util import probe_sni
return jose.ComparableX509(probe_sni(
name, host='127.0.0.1', port=self.port))
def test_probe_ok(self):