diff options
author | Adam Young <ayoung@redhat.com> | 2012-06-22 13:40:17 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2012-07-02 15:12:03 -0400 |
commit | 5ad80860fa227fdab204ea464462c353bc0e59a1 (patch) | |
tree | 482b0658252a7d70635b7d260180c3193aafa2fb /tests/test_cert_setup.py | |
parent | b45c252bca75d55fc720f354c48f5084c2528582 (diff) | |
download | keystone-5ad80860fa227fdab204ea464462c353bc0e59a1.tar.gz keystone-5ad80860fa227fdab204ea464462c353bc0e59a1.tar.xz keystone-5ad80860fa227fdab204ea464462c353bc0e59a1.zip |
keystone_manage certificate generation
Bug 1017554
paths now correspond with SSL
unit test for cert generation
Added mode config values
Explict about umask
replace string concat for paths with proper use of os.path.join
Change-Id: I8b3bec82d7b72993aa69653f63ff64c3f675f716
Diffstat (limited to 'tests/test_cert_setup.py')
-rw-r--r-- | tests/test_cert_setup.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/test_cert_setup.py b/tests/test_cert_setup.py new file mode 100644 index 00000000..ca3a96cd --- /dev/null +++ b/tests/test_cert_setup.py @@ -0,0 +1,52 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 OpenStack LLC +# +# 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. + +import os +import unittest2 as test +import shutil + +from keystone import config +from keystone.common import openssl + +ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +SSLDIR = "%s/tests/ssl/" % ROOTDIR +CONF = config.CONF + + +def rootdir(*p): + return os.path.join(SSLDIR, *p) + + +CERTDIR = rootdir("certs") +KEYDIR = rootdir("private") + +CONF.signing.certfile = os.path.join(CERTDIR, 'signing_cert.pem') +CONF.signing.ca_certs = os.path.join(CERTDIR, "ca.pem") +CONF.signing.keyfile = os.path.join(KEYDIR, "signing_key.pem") + + +class CertSetupTestCase(test.TestCase): + + def test_create_certs(self): + ssl = openssl.ConfigurePKI() + ssl.run() + self.assertTrue(os.path.exists(CONF.signing.certfile)) + self.assertTrue(os.path.exists(CONF.signing.ca_certs)) + self.assertTrue(os.path.exists(CONF.signing.keyfile)) + + def tearDown(self): + shutil.rmtree(rootdir(SSLDIR)) |