mirror of
https://github.com/certbot/certbot.git
synced 2026-06-09 08:42:57 -04:00
Added cert, key, chain, and fullchain abspath tests
This commit is contained in:
parent
dc78f811ce
commit
1dd1523680
1 changed files with 35 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ from letsencrypt.tests import test_util
|
|||
CSR = test_util.vector_path('csr.der')
|
||||
|
||||
|
||||
class CLITest(unittest.TestCase):
|
||||
class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
"""Tests for different commands."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -116,6 +116,23 @@ class CLITest(unittest.TestCase):
|
|||
from letsencrypt import cli
|
||||
self.assertTrue(cli.usage_strings(plugins)[0] in out)
|
||||
|
||||
def test_install_abspath(self):
|
||||
cert = 'cert'
|
||||
key = 'key'
|
||||
chain = 'chain'
|
||||
fullchain = 'fullchain'
|
||||
|
||||
with MockedVerb('install') as mock_install:
|
||||
self._call(['install', '--cert-path', cert, '--key-path', 'key',
|
||||
'--chain-path', 'chain',
|
||||
'--fullchain-path', 'fullchain'])
|
||||
|
||||
args = mock_install.call_args[0][0]
|
||||
self.assertEqual(args.cert_path, os.path.abspath(cert))
|
||||
self.assertEqual(args.key_path, os.path.abspath(key))
|
||||
self.assertEqual(args.chain_path, os.path.abspath(chain))
|
||||
self.assertEqual(args.fullchain_path, os.path.abspath(fullchain))
|
||||
|
||||
@mock.patch('letsencrypt.cli.display_ops')
|
||||
def test_installer_selection(self, mock_display_ops):
|
||||
self._call(['install', '--domain', 'foo.bar', '--cert-path', 'cert',
|
||||
|
|
@ -211,6 +228,23 @@ class CLITest(unittest.TestCase):
|
|||
available = verified.available()
|
||||
stdout.write.called_once_with(str(available))
|
||||
|
||||
def test_certonly_abspath(self):
|
||||
cert = 'cert'
|
||||
key = 'key'
|
||||
chain = 'chain'
|
||||
fullchain = 'fullchain'
|
||||
|
||||
with MockedVerb('certonly') as mock_obtaincert:
|
||||
self._call(['certonly', '--cert-path', cert, '--key-path', 'key',
|
||||
'--chain-path', 'chain',
|
||||
'--fullchain-path', 'fullchain'])
|
||||
|
||||
args = mock_obtaincert.call_args[0][0]
|
||||
self.assertEqual(args.cert_path, os.path.abspath(cert))
|
||||
self.assertEqual(args.key_path, os.path.abspath(key))
|
||||
self.assertEqual(args.chain_path, os.path.abspath(chain))
|
||||
self.assertEqual(args.fullchain_path, os.path.abspath(fullchain))
|
||||
|
||||
def test_certonly_bad_args(self):
|
||||
ret, _, _, _ = self._call(['-d', 'foo.bar', 'certonly', '--csr', CSR])
|
||||
self.assertEqual(ret, '--domain and --csr are mutually exclusive')
|
||||
|
|
|
|||
Loading…
Reference in a new issue