diff --git a/magnumclient/tests/v1/test_certificates_shell.py b/magnumclient/tests/v1/test_certificates_shell.py index c34b9b42..3d79eee6 100644 --- a/magnumclient/tests/v1/test_certificates_shell.py +++ b/magnumclient/tests/v1/test_certificates_shell.py @@ -27,7 +27,7 @@ class ShellTest(shell_test_base.TestCommandLineArgument): mockbay.status = "CREATE_COMPLETE" mock_bay_get.return_value = mockbay self._test_arg_success('ca-show ' - 'xxx') + '--bay xxx') self.assertTrue(mock_cert_get.called) @mock.patch('os.path.isfile') @@ -44,8 +44,8 @@ class ShellTest(shell_test_base.TestCommandLineArgument): file_mock = mock.mock_open(read_data=fake_csr) with mock.patch.object(certificates_shell, 'open', file_mock): self._test_arg_success('ca-sign ' - 'xxx ' - 'path/csr.pem') + '--csr path/csr.pem ' + '--bay xxx') self.assertTrue(mock_cert_create.called) @mock.patch('os.path.isfile') @@ -62,8 +62,8 @@ class ShellTest(shell_test_base.TestCommandLineArgument): file_mock = mock.mock_open(read_data=fake_csr) with mock.patch.object(certificates_shell, 'open', file_mock): self._test_arg_success('ca-sign ' - 'xxx ' - 'path/csr.pem') + '--csr path/csr.pem ' + '--bay xxx') mock_isfile.assert_called_once_with('path/csr.pem') self.assertFalse(file_mock.called) self.assertFalse(mock_cert_create.called) diff --git a/magnumclient/v1/certificates_shell.py b/magnumclient/v1/certificates_shell.py index 510232f0..092e62cd 100644 --- a/magnumclient/v1/certificates_shell.py +++ b/magnumclient/v1/certificates_shell.py @@ -21,7 +21,8 @@ def _show_cert(certificate): print(certificate.pem) -@utils.arg('bay', +@utils.arg('--bay', + required=True, metavar='', help='ID or name of the bay.') def do_ca_show(cs, args): @@ -35,12 +36,13 @@ def do_ca_show(cs, args): _show_cert(cert) -@utils.arg('bay', - metavar='', - help='ID or name of the bay.') -@utils.arg('csr', +@utils.arg('--csr', metavar='', help='File path of the csr file to send to Magnum to get signed.') +@utils.arg('--bay', + required=True, + metavar='', + help='ID or name of the bay.') def do_ca_sign(cs, args): """Generate the CA certificate for a bay.""" bay = cs.bays.get(args.bay)