ac-user-auth / tests /security /test_encryption.py
MukeshKapoor25's picture
first commit
70f8e84
raw
history blame contribute delete
378 Bytes
import ssl
import socket
def test_ssl_certificate():
hostname = "127.0.0.1"
port = 443
context = ssl.create_default_context()
with socket.create_connection((hostname, port)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
cert = ssock.getpeercert()
assert cert is not None, "No SSL certificate found!"