| Conditions | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 1 |
| CRAP Score | 9.3211 |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | 1 | from plugin.core.libraries.tests.core.base import BaseTest |
|
| 12 | 1 | @staticmethod |
|
| 13 | def test_import(): |
||
| 14 | import OpenSSL.SSL |
||
| 15 | |||
| 16 | # Try construct SSL context |
||
| 17 | ctx = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv23_METHOD) |
||
| 18 | |||
| 19 | # Ensure library has SNI support |
||
| 20 | cnx = OpenSSL.SSL.Connection(ctx) |
||
| 21 | |||
| 22 | if not hasattr(cnx, 'set_tlsext_host_name'): |
||
| 23 | raise Exception('Missing SNI extension') |
||
| 24 | |||
| 25 | # Ensure binding can be imported |
||
| 26 | from cryptography.hazmat.bindings.openssl.binding import Binding |
||
| 27 | assert Binding |
||
| 28 | |||
| 29 | return { |
||
| 30 | 'versions': { |
||
| 31 | 'pyopenssl': getattr(OpenSSL, '__version__', None) |
||
| 32 | } |
||
| 48 |