python-urllib3/Address-1365.-CertificateError-str-repr-is-tuple-not.patch
Jeremy Cline 0905637ec9
Backport patch for Python 3.7 support (rhbz 1584112)
Since it's not clear when urllib3 will get a new release, fix the Python
3.7 test failures now.
2018-05-30 08:58:59 -04:00

27 lines
1.0 KiB
Diff

From edd7a0063d25f1a7f34306f9a9488247593888a9 Mon Sep 17 00:00:00 2001
From: Chris Wilcox <crwilcox@google.com>
Date: Fri, 20 Apr 2018 15:50:40 -0700
Subject: [PATCH] Address #1365. CertificateError str repr is tuple, not str.
Signed-off-by: Jeremy Cline <jcline@redhat.com>
---
test/test_connection.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_connection.py b/test/test_connection.py
index be50f6c..dfc757d 100644
--- a/test/test_connection.py
+++ b/test/test_connection.py
@@ -38,7 +38,7 @@ class TestConnection(object):
with mock.patch('urllib3.connection.log.error') as mock_log:
_match_hostname(cert, asserted_hostname)
except CertificateError as e:
- assert str(e) == "hostname 'bar' doesn't match 'foo'"
+ assert "hostname 'bar' doesn't match 'foo'" in str(e)
mock_log.assert_called_once_with(
'Certificate did not match expected hostname: %s. '
'Certificate: %s',
--
2.17.0