� �:Oc@s�dZdZdZdZdZdZdZddlmZdd l Z dd l m Z dd l m Z dd lmZd e jfd��YZedkr�e j�nd S(s�unit tests module for ndg.httpsclient.urllib2_build_opener module 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����(tURLErrorN(tSSL(t Constants(t build_openertUrllib2TestCasecBs2eZdZd�Zd�Zd�Zd�ZRS(s$Unit tests for urllib2 functionalitycCst�}|j|�dS(N(Rtassert_(tselftopener((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyttest01_urllib2_build_openers cCs;t�}|jtj�}|j|�d|j�GHdS(Nsres = %s(RtopenRtTEST_URIRtread(RRtres((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyt test02_opens  cCs&t�}|jt|jtj�dS(N(RtfailUnlessRaisesRR Rt TEST_URI2(RR((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyttest03_open_fails_unknown_loc!s cCsmtjtj�}d�}|jtj|�|jdd�td|�}|jtj |j t j �dS(NcSs|S(N((tconntx509terrnumterrdeptht preverify_ok((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyt<lambda>(ss./t ssl_context( RtContextt SSLv3_METHODt set_verifyt VERIFY_PEERtload_verify_locationstNoneRRtErrorR RR (Rtctxtverify_callbackR((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyt(test04_open_peer_cert_verification_fails%s  (t__name__t __module__t__doc__RR RR!(((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyRs    t__main__(R$t __author__t__date__t __copyright__t __license__t __contact__t __revision__turllib2RtunittesttOpenSSLRtndg.httpsclient.testRt$ndg.httpsclient.urllib2_build_openerRtTestCaseRR"tmain(((sE/usr/lib/python2.7/site-packages/ndg/httpsclient/test/test_urllib2.pyt<module>s