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:
Erica Portnoy
2016-10-26 15:43:40 -07:00
committed by GitHub
parent 42180ee9b5
commit 4b5db7aec4
2 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -179,9 +179,12 @@ class FileDisplay(object):
self._print_menu(message, tags)
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 len(ans.strip()) == 0:
ans = " ".join(str(x) for x in range(1, len(tags)+1))
indices = separate_list_input(ans)
selected_tags = self._scrub_checklist_input(indices, tags)
if selected_tags:
+7
View File
@@ -79,6 +79,13 @@ class FileOutputDisplayTest(unittest.TestCase):
self.assertEqual(
(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")
def test_checklist_miss_valid(self, mock_input):
mock_input.side_effect = [