Merge remote-tracking branch 'github/letsencrypt/master' into test-dirs-chmods

Conflicts:
	letsencrypt_nginx/dvsni.py
This commit is contained in:
Jakub Warmuz 2015-05-15 19:44:07 +00:00
commit a941cf61b7
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA
8 changed files with 39 additions and 43 deletions

View file

@ -3,8 +3,7 @@ include CHANGES.rst
include CONTRIBUTING.md
include linter_plugin.py
include letsencrypt/EULA
recursive-include letsencrypt/client/tests/testdata *
recursive-include letsencrypt/tests/testdata *
recursive-include acme/schemata *.json
recursive-include acme/jose/testdata *

View file

@ -1,5 +0,0 @@
:mod:`letsencrypt.client.proof_of_possession`
--------------------------------------------------
.. automodule:: letsencrypt.client.proof_of_possession
:members:

View file

@ -0,0 +1,5 @@
:mod:`letsencrypt.proof_of_possession`
--------------------------------------
.. automodule:: letsencrypt.proof_of_possession
:members:

View file

@ -19,7 +19,7 @@ class ContinuityAuthenticator(object):
:ivar proof_of_pos: Performs "proofOfPossession" challenges.
:type proof_of_pos:
:class:`letsencrypt.client.proof_of_possession.Proof_of_Possession`
:class:`letsencrypt.proof_of_possession.Proof_of_Possession`
"""
zope.interface.implements(interfaces.IAuthenticator)
@ -32,7 +32,7 @@ class ContinuityAuthenticator(object):
:type config: :class:`letsencrypt.interfaces.IConfig`
:param installer: Let's Encrypt Installer.
:type installer: :class:`letsencrypt.client.interfaces.IInstaller`
:type installer: :class:`letsencrypt.interfaces.IInstaller`
"""
self.rec_token = recovery_token.RecoveryToken(

View file

@ -156,14 +156,6 @@ class GetAuthorizationsTest(unittest.TestCase):
self.assertRaises(errors.AuthorizationError,
self.handler.get_authorizations, ["0"])
def _get_exp_response(self, domain, path, challs):
# pylint: disable=no-self-use
exp_resp = [None] * len(challs)
for i in path:
exp_resp[i] = TRANSLATE[challs[i].typ] + str(domain)
return exp_resp
def _validate_all(self, unused_1, unused_2):
for dom in self.handler.authzr.keys():
azr = self.handler.authzr[dom]
@ -443,19 +435,5 @@ def gen_dom_authzr(domain, unused_new_authzr_uri, challs):
[messages2.STATUS_PENDING]*len(challs))
def gen_path(required, challs):
"""Generate a combination by picking ``required`` from ``challs``.
:param required: Required types of challenges (subclasses of
:class:`~acme.challenges.Challenge`).
:param challs: Sequence of ACME challenge messages, corresponding to
:attr:`acme.messages.Challenge.challenges`.
:return: :class:`list` of :class:`int`
"""
return [challs.index(chall) for chall in required]
if __name__ == "__main__":
unittest.main() # pragma: no cover

View file

@ -12,10 +12,11 @@ class CLITest(unittest.TestCase):
def _call(cls, args):
from letsencrypt import cli
args = ['--text'] + args
with mock.patch("letsencrypt.cli.sys.stdout") as stdout:
with mock.patch("letsencrypt.cli.sys.stderr") as stderr:
ret = cli.main(args)
return ret, stdout, stderr
with mock.patch('letsencrypt.cli.sys.stdout') as stdout:
with mock.patch('letsencrypt.cli.sys.stderr') as stderr:
with mock.patch('letsencrypt.cli.client') as client:
ret = cli.main(args)
return ret, stdout, stderr, client
def test_no_flags(self):
self.assertRaises(SystemExit, self._call, [])
@ -23,6 +24,18 @@ class CLITest(unittest.TestCase):
def test_help(self):
self.assertRaises(SystemExit, self._call, ['--help'])
def test_rollback(self):
_, _, _, client = self._call(['rollback'])
client.rollback.assert_called_once()
_, _, _, client = self._call(['rollback', '--checkpoints', '123'])
client.rollback.assert_called_once_with(
mock.ANY, 123, mock.ANY, mock.ANY)
def test_config_changes(self):
_, _, _, client = self._call(['config_changes'])
client.view_config_changes.assert_called_once()
def test_plugins(self):
flags = ['--init', '--prepare', '--authenticators', '--installers']
for args in itertools.chain(

View file

@ -3,6 +3,8 @@ import datetime
import httplib
import os
import pkg_resources
import shutil
import tempfile
import unittest
import M2Crypto
@ -49,6 +51,8 @@ class NetworkTest(unittest.TestCase):
self.identifier = messages2.Identifier(
typ=messages2.IDENTIFIER_FQDN, value='example.com')
self.config = mock.Mock(accounts_dir=tempfile.mkdtemp())
# Registration
self.contact = ('mailto:cert-admin@example.com', 'tel:+12025551212')
reg = messages2.Registration(
@ -79,6 +83,9 @@ class NetworkTest(unittest.TestCase):
uri='https://www.letsencrypt-demo.org/acme/cert/1',
cert_chain_uri='https://www.letsencrypt-demo.org/ca')
def tearDown(self):
shutil.rmtree(self.config.accounts_dir)
def _mock_post_get(self):
# pylint: disable=protected-access
self.net._post = mock.MagicMock(return_value=self.response)
@ -93,7 +100,7 @@ class NetworkTest(unittest.TestCase):
return self.value
@classmethod
def from_json(cls, value):
return cls(value)
pass # pragma: no cover
# pylint: disable=protected-access
jws = self.net._wrap_in_jws(MockJSONDeSerializable('foo'))
self.assertEqual(jose.JWS.json_loads(jws).payload, '"foo"')
@ -200,8 +207,8 @@ class NetworkTest(unittest.TestCase):
def test_register_from_account(self):
self.net.register = mock.Mock()
acc = account.Account(
mock.Mock(accounts_dir='mock_dir'), 'key',
email='cert-admin@example.com', phone='+12025551212')
self.config, 'key', email='cert-admin@example.com',
phone='+12025551212')
self.net.register_from_account(acc)
@ -210,9 +217,8 @@ class NetworkTest(unittest.TestCase):
def test_register_from_account_partial_info(self):
self.net.register = mock.Mock()
acc = account.Account(
mock.Mock(accounts_dir='mock_dir'), 'key',
email='cert-admin@example.com')
acc2 = account.Account(mock.Mock(accounts_dir='mock_dir'), 'key')
self.config, 'key', email='cert-admin@example.com')
acc2 = account.Account(self.config, 'key')
self.net.register_from_account(acc)
self.net.register.assert_called_with(

View file

@ -78,7 +78,7 @@ class NginxDvsni(ApacheDvsni):
"""Modifies Nginx config to include challenge server blocks.
:param list ll_addrs: list of lists of
:class:`letsencrypt_apache.obj.Addr` to apply
:class:`letsencrypt_nginx.obj.Addr` to apply
:raises errors.LetsEncryptMisconfigurationError:
Unable to find a suitable HTTP block to include DVSNI hosts.
@ -115,7 +115,7 @@ class NginxDvsni(ApacheDvsni):
"""Creates a server block for a DVSNI challenge.
:param achall: Annotated DVSNI challenge.
:type achall: :class:`letsencrypt.client.achallenges.DVSNI`
:type achall: :class:`letsencrypt.achallenges.DVSNI`
:param list addrs: addresses of challenged domain
:class:`list` of type :class:`~nginx.obj.Addr`