mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 16:19:13 +02:00
Allowed for arbitrary length strings from urandom
This commit is contained in:
@@ -51,7 +51,7 @@ class ManualAuthenticatorTest(unittest.TestCase):
|
|||||||
@mock.patch("__builtin__.raw_input")
|
@mock.patch("__builtin__.raw_input")
|
||||||
def test_perform(self, mock_raw_input, mock_verify, mock_urandom,
|
def test_perform(self, mock_raw_input, mock_verify, mock_urandom,
|
||||||
mock_stdout):
|
mock_stdout):
|
||||||
mock_urandom.return_value = "foo"
|
mock_urandom.side_effect = nonrandom_urandom
|
||||||
mock_verify.return_value = True
|
mock_verify.return_value = True
|
||||||
|
|
||||||
resp = challenges.SimpleHTTPResponse(tls=False)
|
resp = challenges.SimpleHTTPResponse(tls=False)
|
||||||
@@ -106,5 +106,10 @@ class ManualAuthenticatorTest(unittest.TestCase):
|
|||||||
mock_killpg.assert_called_once_with(1234, signal.SIGTERM)
|
mock_killpg.assert_called_once_with(1234, signal.SIGTERM)
|
||||||
|
|
||||||
|
|
||||||
|
def nonrandom_urandom(num_bytes):
|
||||||
|
"""Returns a string of length num_bytes"""
|
||||||
|
return "x" * num_bytes
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main() # pragma: no cover
|
unittest.main() # pragma: no cover
|
||||||
|
|||||||
Reference in New Issue
Block a user