1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-21 19:01:07 +03:00

Fix lints & glitches

This commit is contained in:
Peter Eckersley
2015-11-09 22:44:26 -08:00
parent 88cc01301a
commit baaeab5fa1
4 changed files with 12 additions and 9 deletions

View File

@@ -169,7 +169,7 @@ def _determine_account(args, config):
def _init_le_client(args, config, authenticator, installer):
config.deterimine_user_agent(authenticator, installer)
config.determine_user_agent(authenticator, installer)
if authenticator is not None:
# if authenticator was given, then we will need account...
acc, acme = _determine_account(args, config)

View File

@@ -11,6 +11,7 @@ from acme import challenges
from letsencrypt import constants
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt import le_util
class NamespaceConfig(object):
@@ -84,17 +85,19 @@ class NamespaceConfig(object):
return challenges.HTTP01Response.PORT
def determine_user_agent(self, authenticator, installer):
# The user agent string isn't knowable until the authenticator and
# installer have been chosen.
"""
Set a user_agent string in the config based on the choice of plugins.
(this wasn't knowable at construction time)
"""
if self.user_agent is None:
if self.namespace.user_agent is None:
ua = "LetsEncryptPythonClient/{0} ({1}) Authenticator/{2} Installer/{3}"
ua = ua.format(letsencrypt.__version__, le_util.get_os_info(),
authenticator.name if authenticator else "none",
installer.name if installer else "none")
self.user_agent=ua
self.namespace.user_agent = ua
else:
assert isinstance(self.user_agent, str), "User Agent not a string?"
assert isinstance(self.namespace.user_agent, str), "User Agent not a string?"
class RenewerConfiguration(object):

View File

@@ -224,8 +224,8 @@ def get_os_info():
).communicate()[0]
elif os_type.startswith('freebsd'):
# eg "9.3-RC3-p1"
os_ver = os_ver.parititon("-")[0]
os_ver = os_ver.parititon(".")[0]
os_ver = os_ver.partition("-")[0]
os_ver = os_ver.partition(".")[0]
elif platform.win32_ver()[1]:
os_ver = platform.win32_ver()[1]
else:

View File

@@ -71,7 +71,7 @@ class ClientTest(unittest.TestCase):
def test_init_acme_verify_ssl(self):
self.acme_client.assert_called_once_with(
directory=mock.ANY, key=mock.ANY, verify_ssl=True)
directory=mock.ANY, key=mock.ANY, ua=mock.ANY, verify_ssl=True)
def _mock_obtain_certificate(self):
self.client.auth_handler = mock.MagicMock()