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
This commit is contained in:
Lei Zhang
2013-10-15 11:21:56 +08:00
parent 1e158d33bb
commit fb4074c0b1
2 changed files with 28 additions and 1 deletions

View File

@@ -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)

26
test_cms.py Normal file
View File

@@ -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')