diff options
Diffstat (limited to 'tests/extmod/tls_sslcontext_micropython.py')
-rw-r--r-- | tests/extmod/tls_sslcontext_micropython.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/extmod/tls_sslcontext_micropython.py b/tests/extmod/tls_sslcontext_micropython.py new file mode 100644 index 000000000..e188f89b8 --- /dev/null +++ b/tests/extmod/tls_sslcontext_micropython.py @@ -0,0 +1,29 @@ +# Test MicroPython-specific behaviour of tls.SSLContext. + +try: + import tls +except ImportError: + print("SKIP") + raise SystemExit + +# Test constructing without any arguments (in CPython it's a DeprecationWarning). +try: + tls.SSLContext() +except TypeError: + print("TypeError") + +# Test attributes that don't exist (in CPython new attributes can be added). +# This test is needed for coverage because SSLContext implements a custom attr handler. +ctx = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT) +try: + ctx.does_not_exist +except AttributeError: + print("AttributeError on load") +try: + ctx.does_not_exist = None +except AttributeError: + print("AttributeError on store") +try: + del ctx.does_not_exist +except AttributeError: + print("AttributeError on delete") |