diff options
Diffstat (limited to 'tests/extmod/ssl_sslcontext_ciphers.py')
-rw-r--r-- | tests/extmod/ssl_sslcontext_ciphers.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/extmod/ssl_sslcontext_ciphers.py b/tests/extmod/ssl_sslcontext_ciphers.py new file mode 100644 index 0000000000..d87e96afdf --- /dev/null +++ b/tests/extmod/ssl_sslcontext_ciphers.py @@ -0,0 +1,29 @@ +# Basic test of ssl.SSLContext get_ciphers() and set_ciphers() methods. + +try: + import ssl +except ImportError: + print("SKIP") + raise SystemExit + + +ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + +ciphers = ctx.get_ciphers() + +for ci in ciphers: + print(ci) + +ctx.set_ciphers(ciphers[:1]) + +# Test error cases. + +try: + ctx.set_ciphers(ciphers[0]) +except TypeError as e: + print(e) + +try: + ctx.set_ciphers(["BAR"]) +except OSError as e: + print(e) |