mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 00:22:04 +02:00
only print deprecation warning when --standalone-supported-challenges is set
This commit is contained in:
@@ -13,6 +13,7 @@ import zope.interface
|
|||||||
from acme import challenges
|
from acme import challenges
|
||||||
from acme import standalone as acme_standalone
|
from acme import standalone as acme_standalone
|
||||||
|
|
||||||
|
from certbot import cli
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
from certbot import interfaces
|
from certbot import interfaces
|
||||||
|
|
||||||
@@ -120,10 +121,11 @@ def supported_challenges_validator(data):
|
|||||||
It should be passed as `type` argument to `add_argument`.
|
It should be passed as `type` argument to `add_argument`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sys.stderr.write(
|
if cli.set_by_cli("standalone_supported_challenges"):
|
||||||
"WARNING: The standalone specific "
|
sys.stderr.write(
|
||||||
"supported challenges flag is deprecated\n")
|
"WARNING: The standalone specific "
|
||||||
sys.stderr.write("Please use the --preferred-challenges flag instead.\n")
|
"supported challenges flag is deprecated.\n"
|
||||||
|
"Please use the --preferred-challenges flag instead.\n")
|
||||||
challs = data.split(",")
|
challs = data.split(",")
|
||||||
|
|
||||||
# tls-sni-01 was dvsni during private beta
|
# tls-sni-01 was dvsni during private beta
|
||||||
|
|||||||
@@ -67,10 +67,25 @@ class ServerManagerTest(unittest.TestCase):
|
|||||||
class SupportedChallengesValidatorTest(unittest.TestCase):
|
class SupportedChallengesValidatorTest(unittest.TestCase):
|
||||||
"""Tests for plugins.standalone.supported_challenges_validator."""
|
"""Tests for plugins.standalone.supported_challenges_validator."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.set_by_cli_patch = mock.patch(
|
||||||
|
"certbot.plugins.standalone.cli.set_by_cli")
|
||||||
|
self.stderr_patch = mock.patch("certbot.plugins.standalone.sys.stderr")
|
||||||
|
|
||||||
|
self.set_by_cli_patch.start().return_value = True
|
||||||
|
self.stderr = self.stderr_patch.start()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.set_by_cli_patch.stop()
|
||||||
|
self.stderr_patch.stop()
|
||||||
|
|
||||||
def _call(self, data):
|
def _call(self, data):
|
||||||
from certbot.plugins.standalone import (
|
from certbot.plugins.standalone import (
|
||||||
supported_challenges_validator)
|
supported_challenges_validator)
|
||||||
return supported_challenges_validator(data)
|
return_value = supported_challenges_validator(data)
|
||||||
|
self.assertTrue(self.stderr.write.called) # pylint: disable=no-member
|
||||||
|
self.stderr.write.reset_mock() # pylint: disable=no-member
|
||||||
|
return return_value
|
||||||
|
|
||||||
def test_correct(self):
|
def test_correct(self):
|
||||||
self.assertEqual("tls-sni-01", self._call("tls-sni-01"))
|
self.assertEqual("tls-sni-01", self._call("tls-sni-01"))
|
||||||
|
|||||||
Reference in New Issue
Block a user