git » kxd » commit ca7d96c

tests: Update test_no_local_cert expected error code

author Alberto Bertogli
2023-08-23 21:09:55 UTC
committer Alberto Bertogli
2023-08-23 21:13:18 UTC
parent 118686af2ef707c19a1e0578363e7f54a5226e46

tests: Update test_no_local_cert expected error code

In newer versions of the TLS library, the error code returned when the
server is requiring a local certificate has changed.

This patch updates the tests accordingly.

tests/run_tests +5 -1

diff --git a/tests/run_tests b/tests/run_tests
index f0e8634..af6012e 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -357,7 +357,11 @@ class TrickyRequests(TestCase):
             conn.getresponse()
             conn.close()
         except ssl.SSLError as err:
-            self.assertEqual(err.reason, "SSLV3_ALERT_BAD_CERTIFICATE")
+            # Expect one of these errors (the specific one can change
+            # depending on the version of OpenSSL).
+            self.assertIn(err.reason,
+                          ["SSLV3_ALERT_BAD_CERTIFICATE",
+                           "TLSV13_ALERT_CERTIFICATE_REQUIRED"])
         else:
             self.fail("Client call did not fail as expected")