summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/tls_sslcontext_ciphers.py (renamed from tests/extmod/ssl_sslcontext_ciphers.py)6
-rw-r--r--tests/extmod/tls_sslcontext_ciphers.py.exp (renamed from tests/extmod/ssl_sslcontext_ciphers.py.exp)0
-rw-r--r--tests/extmod/tls_sslcontext_micropython.py (renamed from tests/extmod/ssl_sslcontext_micropython.py)8
-rw-r--r--tests/extmod/tls_sslcontext_micropython.py.exp (renamed from tests/extmod/ssl_sslcontext_micropython.py.exp)0
-rw-r--r--tests/multi_net/sslcontext_server_client_ciphers.py16
-rw-r--r--tests/ports/unix/extra_coverage.py.exp4
6 files changed, 19 insertions, 15 deletions
diff --git a/tests/extmod/ssl_sslcontext_ciphers.py b/tests/extmod/tls_sslcontext_ciphers.py
index 20c00b917..43f94fb19 100644
--- a/tests/extmod/ssl_sslcontext_ciphers.py
+++ b/tests/extmod/tls_sslcontext_ciphers.py
@@ -1,13 +1,13 @@
-# Basic test of ssl.SSLContext get_ciphers() and set_ciphers() methods.
+# Basic test of tls.SSLContext get_ciphers() and set_ciphers() methods.
try:
- import ssl
+ import tls
except ImportError:
print("SKIP")
raise SystemExit
-ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ctx = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT)
ciphers = ctx.get_ciphers()
diff --git a/tests/extmod/ssl_sslcontext_ciphers.py.exp b/tests/extmod/tls_sslcontext_ciphers.py.exp
index 0d21a3bd2..0d21a3bd2 100644
--- a/tests/extmod/ssl_sslcontext_ciphers.py.exp
+++ b/tests/extmod/tls_sslcontext_ciphers.py.exp
diff --git a/tests/extmod/ssl_sslcontext_micropython.py b/tests/extmod/tls_sslcontext_micropython.py
index 136fb8a05..e188f89b8 100644
--- a/tests/extmod/ssl_sslcontext_micropython.py
+++ b/tests/extmod/tls_sslcontext_micropython.py
@@ -1,20 +1,20 @@
-# Test MicroPython-specific behaviour of ssl.SSLContext.
+# Test MicroPython-specific behaviour of tls.SSLContext.
try:
- import ssl
+ import tls
except ImportError:
print("SKIP")
raise SystemExit
# Test constructing without any arguments (in CPython it's a DeprecationWarning).
try:
- ssl.SSLContext()
+ 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 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ctx = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT)
try:
ctx.does_not_exist
except AttributeError:
diff --git a/tests/extmod/ssl_sslcontext_micropython.py.exp b/tests/extmod/tls_sslcontext_micropython.py.exp
index 21e65258f..21e65258f 100644
--- a/tests/extmod/ssl_sslcontext_micropython.py.exp
+++ b/tests/extmod/tls_sslcontext_micropython.py.exp
diff --git a/tests/multi_net/sslcontext_server_client_ciphers.py b/tests/multi_net/sslcontext_server_client_ciphers.py
index d65d860fb..c168b444a 100644
--- a/tests/multi_net/sslcontext_server_client_ciphers.py
+++ b/tests/multi_net/sslcontext_server_client_ciphers.py
@@ -3,7 +3,7 @@
try:
import os
import socket
- import ssl
+ import tls
except ImportError:
print("SKIP")
raise SystemExit
@@ -13,6 +13,10 @@ PORT = 8000
# These are test certificates. See tests/README.md for details.
cert = cafile = "ec_cert.der"
key = "ec_key.der"
+with open(cafile, "rb") as f:
+ cadata = f.read()
+with open(key, "rb") as f:
+ keydata = f.read()
try:
os.stat(cafile)
@@ -31,8 +35,8 @@ def instance0():
s.listen(1)
multitest.next()
s2, _ = s.accept()
- server_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
- server_ctx.load_cert_chain(cert, key)
+ server_ctx = tls.SSLContext(tls.PROTOCOL_TLS_SERVER)
+ server_ctx.load_cert_chain(cadata, keydata)
s2 = server_ctx.wrap_socket(s2, server_side=True)
assert isinstance(s2.cipher(), tuple)
print(s2.read(16))
@@ -46,12 +50,12 @@ def instance1():
multitest.next()
s = socket.socket()
s.connect(socket.getaddrinfo(IP, PORT)[0][-1])
- client_ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ client_ctx = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT)
ciphers = client_ctx.get_ciphers()
assert "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" in ciphers
client_ctx.set_ciphers(["TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"])
- client_ctx.verify_mode = ssl.CERT_REQUIRED
- client_ctx.load_verify_locations(cafile=cafile)
+ client_ctx.verify_mode = tls.CERT_REQUIRED
+ client_ctx.load_verify_locations(cadata)
s = client_ctx.wrap_socket(s, server_hostname="micropython.local")
s.write(b"client to server")
print(s.read(16))
diff --git a/tests/ports/unix/extra_coverage.py.exp b/tests/ports/unix/extra_coverage.py.exp
index b7e4c0d76..75c7c32df 100644
--- a/tests/ports/unix/extra_coverage.py.exp
+++ b/tests/ports/unix/extra_coverage.py.exp
@@ -57,8 +57,8 @@ deflate errno example_package
ffi framebuf gc hashlib
heapq io json machine
math os platform random
-re select socket ssl
-struct sys termios time
+re select socket struct
+sys termios time tls
uctypes websocket
me