From fb4074c0b10c98f93283b2e2095adecf0a648ec0 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 15 Oct 2013 11:21:56 +0800 Subject: [PATCH] Migrate the keystone.common.cms to keystoneclient - Add checking the openssl return code 2, related to following review https://review.openstack.org/#/c/22716/ - Add support set subprocess to the cms, when we already know which subprocess to use. Closes-Bug: #1142574 Change-Id: I3f86e6ca8bb7738f57051ce7f0f5662b20e7a22b --- test_auth_token_middleware.py | 3 ++- test_cms.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test_cms.py diff --git a/test_auth_token_middleware.py b/test_auth_token_middleware.py index 588c91f..4e2c2a3 100644 --- a/test_auth_token_middleware.py +++ b/test_auth_token_middleware.py @@ -31,6 +31,7 @@ import mock import webob from keystoneclient.common import cms +from keystoneclient import exceptions from keystoneclient.middleware import auth_token from keystoneclient.openstack.common import jsonutils from keystoneclient.openstack.common import memorycache @@ -876,7 +877,7 @@ class CertDownloadMiddlewareTest(BaseAuthTokenMiddlewareTest): httpretty.register_uri(httpretty.GET, "%s/v2.0/certificates/signing" % BASE_URI, status=404) - self.assertRaises(cms.subprocess.CalledProcessError, + self.assertRaises(exceptions.CertificateConfigError, self.middleware.verify_signed_token, client_fixtures.SIGNED_TOKEN_SCOPED) diff --git a/test_cms.py b/test_cms.py new file mode 100644 index 0000000..8f9cb73 --- /dev/null +++ b/test_cms.py @@ -0,0 +1,26 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from keystoneclient.common import cms +from keystoneclient import exceptions +from keystoneclient.tests import utils + + +class CMSTest(utils.TestCase): + def test_cms_verify(self): + self.assertRaises(exceptions.CertificateConfigError, + cms.cms_verify, + 'data', + 'no_exist_cert_file', + 'no_exist_ca_file')