]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/tests/test_ssl.py
4 from ..tests
import CLICommandTestMixin
, CmdException
7 class SslTest(unittest
.TestCase
, CLICommandTestMixin
):
9 def test_ssl_certificate_and_key(self
):
10 with self
.assertRaises(CmdException
) as ctx
:
11 self
.exec_cmd('set-ssl-certificate', inbuf
='', mgr_id
='x')
12 self
.assertEqual(ctx
.exception
.retcode
, -errno
.EINVAL
)
13 self
.assertEqual(str(ctx
.exception
), 'Please specify the certificate with "-i" option')
15 result
= self
.exec_cmd('set-ssl-certificate', inbuf
='content', mgr_id
='x')
16 self
.assertEqual(result
, 'SSL certificate updated')
18 with self
.assertRaises(CmdException
) as ctx
:
19 self
.exec_cmd('set-ssl-certificate-key', inbuf
='', mgr_id
='x')
20 self
.assertEqual(ctx
.exception
.retcode
, -errno
.EINVAL
)
21 self
.assertEqual(str(ctx
.exception
), 'Please specify the certificate key with "-i" option')
23 result
= self
.exec_cmd('set-ssl-certificate-key', inbuf
='content', mgr_id
='x')
24 self
.assertEqual(result
, 'SSL certificate key updated')
26 def test_set_mgr_created_self_signed_cert(self
):
27 result
= self
.exec_cmd('create-self-signed-cert')
28 self
.assertEqual(result
, 'Self-signed certificate created')