Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/ndg/httpsclient/test/ |
| [Home] [System Details] [Kill Me] |
�
�/Oc@s�dZdZdZdZdZdZdZddlZejd ej �ej
e�Zddl
Z
ddlZdd
lmZddlmZddlmZdd
lmZde
jfd��YZedkr�e
j�ndS(s�unit
tests module for ndg.httpsclient.https.HTTPSconnection class
PyOpenSSL utility to make a httplib-like interface suitable for use with
urllib2
sP J Kershaw (STFC)s06/01/12s2(C) 2012 Science and Technology Facilities
Councils-BSD - see LICENSE file in top-level
directorysPhilip.Kershaw@stfc.ac.uks$Id$i����Ntlevel(tSSL(t Constants(tHTTPSConnection(tServerSSLCertVerificationtTestHTTPSConnectioncBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s+Test
ndg HTTPS client HTTPSConnection
classcCs[ttjdtj�}|j�|jdd�|j�}d|j�GH|j�dS(NtporttGETt/s
Response
=
%s( RRtHOSTNAMEtPORTtconnecttrequesttgetresponsetreadtclose(tselftconntresp((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyttest01_opens
cCs2ttjdtj�}|jtj|j�dS(NR(RRR tPORT2tfailUnlessRaisestsocketterrorR(RR((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyttest02_open_fails$scCs�tjtj�}d�}|jtj|�|jd�|jdtj �t
tjdtjd|�}|j
�|jtj|jdd�dS(NcSstjd|j��|S(Ns/SSL
peer certificate verification failed for
%r(tlogtdebugtget_subject(Rtx509terrnumterrdepthtpreverify_ok((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pytverify_callback+s
i Rtssl_contextRR(RtContexttSSLv3_METHODt
set_verifytVERIFY_PEERtset_verify_depthtload_verify_locationstNoneRtUNITTEST_DIRRR R
RRtErrorR(RtctxR
R((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt%test03_ssl_verification_of_peer_fails(s
cCs�tjtj�}d�}|jtj|�|jd�|jdtj �t
tjdtjd|�}|j
�|jdd�|j�}d|j�GHdS(NcSs|S(N((RRRRR((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt<lambda>>si RR!RRs
Response
= %s(RR"R#R$R%R&R'R(Rt
CACERT_DIRRR R
RRR
R(RR+R
RR((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt(test03_ssl_verification_of_peer_succeeds;s
cCs�tjtj�}tdd�}|jtj|�|jd�|jdt j
�tt jdt j
d|�}|j�|jdd�|j�}d|j�GHdS( Nthostnamet localhosti RR!RRs
Response
= %s(RR"R#RR$R%R&R'R(RR.RR R
RRR
R(RR+R
RR((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt*test04_ssl_verification_with_subj_alt_nameNs
cCs�tjtj�}tdddt�}|jtj|�|jd�|jdt
j�tt
j
dt
jd|�}|j�|jdd�|j�}d |j�GHdS(
NR0R1tsubj_alt_name_matchi RR!RRs
Response =
%s(RR"R#RtFalseR$R%R&R'R(RR.RR R
RRR
R(RR+R
RR((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt-test04_ssl_verification_with_subj_common_name`s
( t__name__t
__module__t__doc__RRR,R/R2R5(((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyRs t__main__(R8t
__author__t__date__t
__copyright__t__license__t__contact__t__revision__tloggingtbasicConfigtDEBUGt getLoggerR6RtunittestRtOpenSSLRtndg.httpsclient.testRtndg.httpsclient.httpsRt%ndg.httpsclient.ssl_peer_verificationRtTestCaseRtmain(((sC/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_https.pyt<module>s$]