From c97f4e8a66ce55df3c32d4a198043ad2e7e8e9cd Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 9 Oct 2013 16:56:17 +0200 Subject: Use new CLI options in certinstall tests The --pin and --dirman-password options simplified ipa-certinstall usage. Use them in tests. Also add tests for the old way of calling the command. https://fedorahosted.org/freeipa/ticket/3869 http://www.freeipa.org/page/V3/ipa-server-certinstall_CLI_cleanup --- ipatests/test_integration/test_caless.py | 45 +++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'ipatests') diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py index ed0554c6..9866705b 100644 --- a/ipatests/test_integration/test_caless.py +++ b/ipatests/test_integration/test_caless.py @@ -1235,24 +1235,21 @@ class TestCertinstall(CALessBase): def certinstall(self, mode, cert_nick=None, cert_exists=True, filename='server.p12', pin=_DEFAULT, stdin_text=None, - p12_pin=None): + p12_pin=None, args=None): if cert_nick: self.export_pkcs12(cert_nick, password=p12_pin) if pin is _DEFAULT: pin = self.cert_password if cert_exists: self.copy_cert(self.master, filename) - args = ['ipa-server-certinstall', - '-%s' % mode, filename] - if pin is not None: - option = {'w': '--http_pin', 'd': '--dirsrv_pin'}[mode] - args += [option, pin] - if mode == 'd': - if stdin_text: - stdin_text = '%s\n%s' % (self.master.config.dirman_password, - stdin_text) - else: - stdin_text = self.master.config.dirman_password + '\n' + if not args: + args = ['ipa-server-certinstall', + '-%s' % mode, filename] + if pin is not None: + args += ['--pin', pin] + if mode == 'd': + args += ['--dirman-password', + self.master.config.dirman_password] return self.master.run_command(args, raiseonerr=False, stdin_text=stdin_text) @@ -1437,3 +1434,27 @@ class TestCertinstall(CALessBase): result = self.certinstall('d', 'ca1/server', pin='', p12_pin='') assert result.returncode == 0 + + def test_http_old_options(self): + "Install new valid DS certificate using pre-v3.3 CLI options" + # http://www.freeipa.org/page/V3/ipa-server-certinstall_CLI_cleanup + + args = ['ipa-server-certinstall', + '-w', 'server.p12', + '--http_pin', self.cert_password] + + result = self.certinstall('w', 'ca1/server', args=args) + assert result.returncode == 0 + + def test_ds_old_options(self): + "Install new valid DS certificate using pre-v3.3 CLI options" + # http://www.freeipa.org/page/V3/ipa-server-certinstall_CLI_cleanup + + args = ['ipa-server-certinstall', + '-d', 'server.p12', + '--dirsrv_pin', self.cert_password] + stdin_text = self.master.config.dirman_password + '\n' + + result = self.certinstall('d', 'ca1/server', + args=args, stdin_text=stdin_text) + assert result.returncode == 0 -- cgit