________________ HttpsCertificateTestCase.test_https_cert_error ________________
self = <tests.http_tests.HttpsCertificateTestCase testMethod=test_https_cert_error>
def test_https_cert_error(self):
"""Test if http.fetch respects disable_ssl_certificate_validation."""
self.assertRaises(pywikibot.FatalServerError,
http.fetch,
uri='https://testssl-expire-r2i2.disig.sk/index.en.html')
with warnings.catch_warnings(record=True) as warning_log:
response = http.fetch(
uri='https://testssl-expire-r2i2.disig.sk/index.en.html',
disable_ssl_certificate_validation=True)
r = response.content
self.assertIsInstance(r, unicode)
self.assertTrue(re.search(r'<title>.*</title>', r))
# Verify that it now fails again
http.session.close() # but first clear the connection
self.assertRaises(pywikibot.FatalServerError,
http.fetch,
uri='https://testssl-expire-r2i2.disig.sk/index.en.html')
# Verify that the warning occurred
> self.assertEqual(len(warning_log), 1)
E AssertionError: 2 != 1
tests/http_tests.py:150: AssertionErrorSee: https://travis-ci.org/wikimedia/pywikibot-core/jobs/177771387#L4557-L4585