mirror of
https://github.com/certbot/certbot.git
synced 2026-06-07 07:42:08 -04:00
Test CLI plugins command
This commit is contained in:
parent
b4f99df798
commit
9e7918fc75
1 changed files with 28 additions and 2 deletions
|
|
@ -1,11 +1,37 @@
|
|||
"""Tests for letsencrypt.client.cli."""
|
||||
import itertools
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
import zope.component
|
||||
|
||||
from letsencrypt.client.display import util as display_util
|
||||
|
||||
|
||||
class CLITest(unittest.TestCase):
|
||||
"""Tests for different commands."""
|
||||
|
||||
def test_it(self):
|
||||
def _call(self, args):
|
||||
from letsencrypt.client import cli
|
||||
self.assertRaises(SystemExit, cli.main, ['--help'])
|
||||
args = ['--text'] + args
|
||||
with mock.patch("letsencrypt.client.cli.sys.stdout") as stdout:
|
||||
with mock.patch("letsencrypt.client.cli.sys.stderr") as stderr:
|
||||
ret = cli.main(args)
|
||||
return ret, stdout, stderr
|
||||
|
||||
def test_no_flags(self):
|
||||
self.assertRaises(SystemExit, self._call, [])
|
||||
|
||||
def test_help(self):
|
||||
self.assertRaises(SystemExit, self._call, ['--help'])
|
||||
|
||||
def test_plugins(self):
|
||||
flags = ['--init', '--prepare', '--authenticators', '--installers']
|
||||
for args in itertools.chain(*(itertools.combinations(flags, r)
|
||||
for r in xrange(len(flags)))):
|
||||
print args
|
||||
self._call(['plugins',] + list(args))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue