mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 16:14:44 +02:00
Allow user to select all domains by typing empty string at checklist (#3693)
* Allow user to select all domains by typing empty string at checklist
This commit is contained in:
@@ -179,9 +179,12 @@ class FileDisplay(object):
|
|||||||
self._print_menu(message, tags)
|
self._print_menu(message, tags)
|
||||||
|
|
||||||
code, ans = self.input("Select the appropriate numbers separated "
|
code, ans = self.input("Select the appropriate numbers separated "
|
||||||
"by commas and/or spaces")
|
"by commas and/or spaces, or leave input "
|
||||||
|
"blank to select all options shown")
|
||||||
|
|
||||||
if code == OK:
|
if code == OK:
|
||||||
|
if len(ans.strip()) == 0:
|
||||||
|
ans = " ".join(str(x) for x in range(1, len(tags)+1))
|
||||||
indices = separate_list_input(ans)
|
indices = separate_list_input(ans)
|
||||||
selected_tags = self._scrub_checklist_input(indices, tags)
|
selected_tags = self._scrub_checklist_input(indices, tags)
|
||||||
if selected_tags:
|
if selected_tags:
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ class FileOutputDisplayTest(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
(code, set(tag_list)), (display_util.OK, set(["tag1", "tag2"])))
|
(code, set(tag_list)), (display_util.OK, set(["tag1", "tag2"])))
|
||||||
|
|
||||||
|
@mock.patch("certbot.display.util.FileDisplay.input")
|
||||||
|
def test_checklist_empty(self, mock_input):
|
||||||
|
mock_input.return_value = (display_util.OK, "")
|
||||||
|
code, tag_list = self.displayer.checklist("msg", TAGS)
|
||||||
|
self.assertEqual(
|
||||||
|
(code, set(tag_list)), (display_util.OK, set(["tag1", "tag2", "tag3"])))
|
||||||
|
|
||||||
@mock.patch("certbot.display.util.FileDisplay.input")
|
@mock.patch("certbot.display.util.FileDisplay.input")
|
||||||
def test_checklist_miss_valid(self, mock_input):
|
def test_checklist_miss_valid(self, mock_input):
|
||||||
mock_input.side_effect = [
|
mock_input.side_effect = [
|
||||||
|
|||||||
Reference in New Issue
Block a user