Skip to content

Commit

Permalink
Fixed output (#3637). (#3809)
Browse files Browse the repository at this point in the history
  • Loading branch information
dashaxiong authored and pde committed Nov 30, 2016
1 parent df5f088 commit 83966cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions certbot/cli.py
Expand Up @@ -335,6 +335,7 @@ def __init__(self, args, plugins, detect_defaults=False):
self.help_topics = HELP_TOPICS + plugin_names + [None]
usage, short_usage = usage_strings(plugins)
self.parser = configargparse.ArgParser(
prog="certbot",
usage=short_usage,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
args_for_setting_config_path=["-c", "--config"],
Expand Down
15 changes: 15 additions & 0 deletions certbot/tests/cli_test.py
Expand Up @@ -143,6 +143,21 @@ def test_help(self):
out = self._help_output(['-h'])
self.assertTrue(cli.usage_strings(plugins)[0] in out)

def test_version_string_program_name(self):
toy_out = six.StringIO()
toy_err = six.StringIO()
with mock.patch('certbot.main.sys.stdout', new=toy_out):
with mock.patch('certbot.main.sys.stderr', new=toy_err):
try:
main.main(["--version"])
except SystemExit:
pass
finally:
output = toy_out.getvalue() or toy_err.getvalue()
self.assertTrue("certbot" in output, "Output is {0}".format(output))
toy_out.close()
toy_err.close()

def _cli_missing_flag(self, args, message):
"Ensure that a particular error raises a missing cli flag error containing message"
exc = None
Expand Down

0 comments on commit 83966cd

Please sign in to comment.