Skip to content

Commit

Permalink
Attempt to update revoke() cases [not yet working]
Browse files Browse the repository at this point in the history
  • Loading branch information
pde committed Nov 13, 2015
1 parent 7e1a59a commit 2433de8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion letsencrypt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


def acme_from_config_key(config, key):
"Wrange ACME client construction"
"Wrangle ACME client construction"
# TODO: Allow for other alg types besides RS256
net = acme_client.ClientNetwork(key, verify_ssl=(not config.no_verify_ssl),
user_agent=_determine_user_agent(config))
Expand All @@ -46,6 +46,7 @@ def _determine_user_agent(config):
Set a user_agent string in the config based on the choice of plugins.
(this wasn't knowable at construction time)
:returns: the client's User-Agent string
:rtype: `str`
"""

Expand Down
9 changes: 7 additions & 2 deletions letsencrypt/tests/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

import mock

from acme import jose

from letsencrypt import account
from letsencrypt import cli
from letsencrypt import configuration
from letsencrypt import crypto_util
from letsencrypt import errors
from letsencrypt import le_util

Expand All @@ -22,7 +25,9 @@
from letsencrypt.tests import test_util


CERT = test_util.vector_path('cert.pem')
CSR = test_util.vector_path('csr.der')
KEY = test_util.vector_path('rsa256_key.pem')


class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
Expand Down Expand Up @@ -406,13 +411,13 @@ def test_certonly_csr(self, _rec, mock_init, mock_get_utility,
self.assertTrue(
date in mock_get_utility().add_message.call_args[0][0])

@mock.patch('letsencrypt.cli.acme_client')
@mock.patch('letsencrypt.cli.client.acme_from_config_key')
def test_revoke_with_key(self, mock_acme_client):
server = 'foo.bar'
self._call(['--cert-path', CERT, '--key-path', KEY,
'--server', server, 'revoke'])
with open(KEY) as f:
mock_acme_client.Client.assert_called_once_with(
mock_acme_client.assert_called_once_with(
server, key=jose.JWK.load(f.read()))
with open(CERT) as f:
mock_acme_client.Client().revoke.assert_called_once_with(
Expand Down

0 comments on commit 2433de8

Please sign in to comment.