Merge "Fix an issue with broken test on ci"

This commit is contained in:
Jenkins
2015-07-13 21:34:19 +00:00
committed by Gerrit Code Review
2 changed files with 43 additions and 28 deletions

View File

@@ -91,16 +91,16 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
client = v1.client.Client(url,
insecure=False,
ssl_compression=True)
client = v1.Client(url,
insecure=False,
ssl_compression=True)
client.images.get('image123')
self.fail('No SSL exception raised')
self.fail('No SSL exception has been raised')
except exc.CommunicationError as e:
if 'certificate verify failed' not in e.message:
self.fail('No certificate failure message received')
except Exception as e:
self.fail('Unexpected exception raised')
self.fail('No certificate failure message is received')
except Exception:
self.fail('Unexpected exception has been raised')
def test_v1_requests_cert_verification_no_compression(self):
"""v1 regression test for bug 115260."""
@@ -108,16 +108,16 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
client = v1.client.Client(url,
insecure=False,
ssl_compression=False)
client = v1.Client(url,
insecure=False,
ssl_compression=False)
client.images.get('image123')
self.fail('No SSL exception raised')
self.fail('No SSL exception has been raised')
except SSL.Error as e:
if 'certificate verify failed' not in str(e):
self.fail('No certificate failure message received')
except Exception as e:
self.fail('Unexpected exception raised')
self.fail('No certificate failure message is received')
except Exception:
self.fail('Unexpected exception has been raised')
def test_v2_requests_cert_verification(self):
"""v2 regression test for bug 115260."""
@@ -125,16 +125,16 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
gc = v2.client.Client(url,
insecure=False,
ssl_compression=True)
gc = v2.Client(url,
insecure=False,
ssl_compression=True)
gc.images.get('image123')
self.fail('No SSL exception raised')
self.fail('No SSL exception has been raised')
except exc.CommunicationError as e:
if 'certificate verify failed' not in e.message:
self.fail('No certificate failure message received')
except Exception as e:
self.fail('Unexpected exception raised')
self.fail('No certificate failure message is received')
except Exception:
self.fail('Unexpected exception has been raised')
def test_v2_requests_cert_verification_no_compression(self):
"""v2 regression test for bug 115260."""
@@ -142,16 +142,16 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
gc = v2.client.Client(url,
insecure=False,
ssl_compression=False)
gc = v2.Client(url,
insecure=False,
ssl_compression=False)
gc.images.get('image123')
self.fail('No SSL exception raised')
self.fail('No SSL exception has been raised')
except SSL.Error as e:
if 'certificate verify failed' not in str(e):
self.fail('No certificate failure message received')
except Exception as e:
self.fail('Unexpected exception raised')
self.fail('No certificate failure message is received')
except Exception:
self.fail('Unexpected exception has been raised')
class TestVerifiedHTTPSConnection(testtools.TestCase):

View File

@@ -0,0 +1,15 @@
# Copyright (c) 2015 Mirantis, Inc.
#
# 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 glanceclient.v2.client import Client # noqa