Skip to content

Commit

Permalink
test: Update our RHSM server setup
Browse files Browse the repository at this point in the history
Ever since python 3.12, ssl library got rid of already deprecated
ssl.wrap_socket and instead replaced it with context.wrap_socket
This required few changes to how we setup our http server.
This should fix fedora-39's testCreateDownloadRhel
  • Loading branch information
skobyda committed Aug 28, 2023
1 parent 7c5fc89 commit 39b6f62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/files/mock-rhsm-rest
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class handler(BaseHTTPRequestHandler):


if __name__ == '__main__':
httpd = HTTPServer(('', 443), handler)
httpd.socket = ssl.wrap_socket(httpd.socket, certfile=sys.argv[1], keyfile=sys.argv[2], server_side=True)
httpd.serve_forever()
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile=sys.argv[1], keyfile=sys.argv[2])
context.check_hostname = False

with HTTPServer(("localhost", 443), handler) as httpd:
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()

0 comments on commit 39b6f62

Please sign in to comment.