
    Bfi8                         d Z dZdZdZdZdZdZddlZddlZdd	l	m
Z
 dd
lmZ ddlmZmZmZmZ  G d dej$                        Zedk(  r ej*                          yy)zunit tests module for ndg.httpsclient.utils module

PyOpenSSL utility to make a httplib-like interface suitable for use with 
urllib2
zP J Kershaw (STFC)z06/01/12z2(C) 2012 Science and Technology Facilities Councilz-BSD - see LICENSE file in top-level directoryzPhilip.Kershaw@stfc.ac.ukz$Id$    N)SSL)	Constants)Configurationfetch_from_urlopen_url_should_use_proxyc                   (    e Zd ZdZd Zd Zd Zd Zy)TestUtilsModulez!Test ndg.httpsclient.utils modulec                     t        t        j                  t        j                        d      }| j	                  |j
                         | j                  |j                  d       y NT)r   r   ContextTLSv1_2_METHOD
assertTruessl_contextassertEqualdebug)selfconfigs     q/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/ndg/httpsclient/test/test_utils.pytest01_configurationz$TestUtilsModule.test01_configuration   sC    s{{3+=+=>E**+t,    c                     t        t        j                  t        j                        d      }t	        t
        j                  |      }| j                  |       y r   )r   r   r   r   r   r   TEST_URIr   r   r   ress      r   test02_fetch_from_urlz%TestUtilsModule.test02_fetch_from_url   s;    s{{3+=+=>EY//8r   c                     t        t        j                  t        j                        d      }t	        t
        j                  |      }| j                  |d   ddt
        j                  z         y )NTr      zopen_url for %r failed)r   r   r   r   r   r   r   r   r   s      r   test03_open_urlzTestUtilsModule.test03_open_url#   sT    s{{3+=+=>Ey))62Q1I4F4FF	Hr   c                    dt         j                  v r%t         j                  d   }t         j                  d= nd }| j                  t        t        j
                        d       dt         j                  d<   | j                  t        t        j
                        d       ||t         j                  d<   y t         j                  d= y )Nno_proxyzExpecting use proxy = Truezlocalhost,localhost.localdomainzExpecting use proxy = False)osenvironr   r   r   r   assertFalse)r   r!   s     r   test04__should_use_proxyz(TestUtilsModule.test04__should_use_proxy)   s    #zz*-H

:&H))*<*<=4	6 "C

:*9+=+=>6	8 %-BJJz"

:&r   N)__name__
__module____qualname____doc__r   r   r   r%    r   r   r
   r
      s    +-

H'r   r
   __main__)r)   
__author____date____copyright____license____contact____revision__unittestr"   OpenSSLr   ndg.httpsclient.testr   ndg.httpsclient.utilsr   r   r   r   TestCaser
   r&   mainr*   r   r   <module>r8      sm   
 "
D=)  	  *6 6$'h'' $'N zHMMO r   