Adding --dialog argument

This commit is contained in:
Amjad Mashaal
2016-05-25 02:22:56 +02:00
parent 118e0d65d5
commit 87d0e938ad
3 changed files with 11 additions and 1 deletions
+3
View File
@@ -569,6 +569,9 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False):
help="Run without ever asking for user input. This may require " help="Run without ever asking for user input. This may require "
"additional command line flags; the client will try to explain " "additional command line flags; the client will try to explain "
"which ones are required if it finds one missing") "which ones are required if it finds one missing")
helpful.add(
None, "--dialog", dest="dialog_mode", action="store_true",
help="Run using dialog")
helpful.add( helpful.add(
None, "--dry-run", action="store_true", dest="dry_run", None, "--dry-run", action="store_true", dest="dry_run",
help="Perform a test run of the client, obtaining test (invalid) certs" help="Perform a test run of the client, obtaining test (invalid) certs"
+2 -1
View File
@@ -677,8 +677,9 @@ def main(cli_args=sys.argv[1:]):
displayer = display_util.NoninteractiveDisplay(sys.stdout) displayer = display_util.NoninteractiveDisplay(sys.stdout)
elif config.text_mode: elif config.text_mode:
displayer = display_util.FileDisplay(sys.stdout) displayer = display_util.FileDisplay(sys.stdout)
elif config.dialog_mode:
displayer = display_util.NcursesDisplay()
elif config.verb == "renew": elif config.verb == "renew":
config.noninteractive_mode = True
displayer = display_util.NoninteractiveDisplay(sys.stdout) displayer = display_util.NoninteractiveDisplay(sys.stdout)
else: else:
displayer = display_util.NcursesDisplay() displayer = display_util.NcursesDisplay()
+6
View File
@@ -149,6 +149,12 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
args.extend(['--email', 'io@io.is']) args.extend(['--email', 'io@io.is'])
self._cli_missing_flag(args, "--agree-tos") self._cli_missing_flag(args, "--agree-tos")
@mock.patch('certbot.main.renew')
def test_gui(self, renew):
args = ['renew', '--dialog']
self._call(args)
self.assertFalse(renew.call_args[0][0].noninteractive_mode)
@mock.patch('certbot.main.client.acme_client.Client') @mock.patch('certbot.main.client.acme_client.Client')
@mock.patch('certbot.main._determine_account') @mock.patch('certbot.main._determine_account')
@mock.patch('certbot.main.client.Client.obtain_and_enroll_certificate') @mock.patch('certbot.main.client.Client.obtain_and_enroll_certificate')