2001-08-20 19:39:42 -03:00
|
|
|
# Test just the SSL support in the socket module, in a moderately bogus way.
|
|
|
|
|
2002-07-23 16:04:11 -03:00
|
|
|
from test import test_support
|
2001-08-20 19:39:42 -03:00
|
|
|
|
|
|
|
# Optionally test SSL support. This currently requires the 'network' resource
|
|
|
|
# as given on the regrtest command line. If not available, nothing after this
|
|
|
|
# line will be executed.
|
|
|
|
test_support.requires('network')
|
|
|
|
|
|
|
|
import socket
|
2001-09-06 06:54:47 -03:00
|
|
|
if not hasattr(socket, "ssl"):
|
|
|
|
raise test_support.TestSkipped("socket module has no ssl support")
|
|
|
|
|
2001-08-20 19:39:42 -03:00
|
|
|
import urllib
|
|
|
|
|
2001-10-17 21:30:14 -03:00
|
|
|
socket.RAND_status()
|
|
|
|
try:
|
|
|
|
socket.RAND_egd(1)
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
print "didn't raise TypeError"
|
|
|
|
socket.RAND_add("this is a random string", 75.0)
|
|
|
|
|
|
|
|
f = urllib.urlopen('https://sf.net')
|
|
|
|
buf = f.read()
|
|
|
|
f.close()
|