From 9900eaa2698ef493d15237cb737bdfcc51ac193f Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 25 Jun 2023 15:28:09 +1000 Subject: [PATCH] tests/extmod: Add test for passing cadata into ssl.wrap_socket(). For coverage. Signed-off-by: Damien George --- tests/extmod/ssl_cadata.py | 14 ++++++++++++++ tests/extmod/ssl_cadata.py.exp | 1 + 2 files changed, 15 insertions(+) create mode 100644 tests/extmod/ssl_cadata.py create mode 100644 tests/extmod/ssl_cadata.py.exp diff --git a/tests/extmod/ssl_cadata.py b/tests/extmod/ssl_cadata.py new file mode 100644 index 0000000000..a68cae1ecb --- /dev/null +++ b/tests/extmod/ssl_cadata.py @@ -0,0 +1,14 @@ +# Test ssl.wrap_socket() with cadata passed in. + +try: + import io + import ssl +except ImportError: + print("SKIP") + raise SystemExit + +# Invalid cadata. +try: + ssl.wrap_socket(io.BytesIO(), cadata=b"!") +except ValueError as er: + print(repr(er)) diff --git a/tests/extmod/ssl_cadata.py.exp b/tests/extmod/ssl_cadata.py.exp new file mode 100644 index 0000000000..9f1cf732e3 --- /dev/null +++ b/tests/extmod/ssl_cadata.py.exp @@ -0,0 +1 @@ +ValueError('invalid cert',)