Attempt to update revoke() cases [not yet working]

This commit is contained in:
Peter Eckersley
2015-11-13 12:48:44 -08:00
parent 7e1a59ab29
commit 2433de8cba
2 changed files with 9 additions and 3 deletions
+2 -1
View File
@@ -34,7 +34,7 @@ logger = logging.getLogger(__name__)
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))
@@ -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`
"""
+7 -2
View File
@@ -10,9 +10,12 @@ import unittest
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
@@ -22,7 +25,9 @@ from letsencrypt.tests import renewer_test
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
@@ -406,13 +411,13 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
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(