(self)
| 586 | |
| 587 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 588 | def test_openssl111_deprecations(self): |
| 589 | options = [ |
| 590 | ssl.OP_NO_TLSv1, |
| 591 | ssl.OP_NO_TLSv1_1, |
| 592 | ssl.OP_NO_TLSv1_2, |
| 593 | ssl.OP_NO_TLSv1_3 |
| 594 | ] |
| 595 | protocols = [ |
| 596 | ssl.PROTOCOL_TLSv1, |
| 597 | ssl.PROTOCOL_TLSv1_1, |
| 598 | ssl.PROTOCOL_TLSv1_2, |
| 599 | ssl.PROTOCOL_TLS |
| 600 | ] |
| 601 | versions = [ |
| 602 | ssl.TLSVersion.SSLv3, |
| 603 | ssl.TLSVersion.TLSv1, |
| 604 | ssl.TLSVersion.TLSv1_1, |
| 605 | ] |
| 606 | |
| 607 | for option in options: |
| 608 | with self.subTest(option=option): |
| 609 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 610 | with self.assertWarns(DeprecationWarning) as cm: |
| 611 | ctx.options |= option |
| 612 | self.assertEqual( |
| 613 | 'ssl.OP_NO_SSL*/ssl.OP_NO_TLS* options are deprecated', |
| 614 | str(cm.warning) |
| 615 | ) |
| 616 | |
| 617 | for protocol in protocols: |
| 618 | if not has_tls_protocol(protocol): |
| 619 | continue |
| 620 | with self.subTest(protocol=protocol): |
| 621 | with self.assertWarns(DeprecationWarning) as cm: |
| 622 | ssl.SSLContext(protocol) |
| 623 | self.assertEqual( |
| 624 | f'ssl.{protocol.name} is deprecated', |
| 625 | str(cm.warning) |
| 626 | ) |
| 627 | |
| 628 | for version in versions: |
| 629 | if not has_tls_version(version): |
| 630 | continue |
| 631 | with self.subTest(version=version): |
| 632 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 633 | with self.assertWarns(DeprecationWarning) as cm: |
| 634 | ctx.minimum_version = version |
| 635 | version_text = '%s.%s' % (version.__class__.__name__, version.name) |
| 636 | self.assertEqual( |
| 637 | f'ssl.{version_text} is deprecated', |
| 638 | str(cm.warning) |
| 639 | ) |
| 640 | |
| 641 | def bad_cert_test(self, certfile): |
| 642 | """Check that trying to use the given client certificate fails""" |
nothing calls this directly
no test coverage detected