σ
¨[c           @` s?  d  d l  m Z m Z m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l m Z d  d l m Z m Z d  d l m Z m Z m Z d  d	 l m Z d  d
 l m Z d e f d     YZ d e f d     YZ d e j f d     YZ d   Z e   j e    d   Z e   j e    d S(   i    (   t   absolute_importt   divisiont   print_function(   t	   validator(   t   json_decode(   t   TypeCheckHandler(   t   ignore_deprecation(   t   AsyncHTTPTestCase(   t   RequestHandlert   Application(   t   WSGIApplicationt   WSGIContainert   WSGIAdapter(   t   httpserver_test(   t   web_testt   WSGIContainerTestc           B` s#   e  Z d    Z d   Z d   Z RS(   c         C` s#   d } d g } | | |  d g S(   Ns   200 OKs   Content-Types
   text/plains   Hello world!(   s   Content-Types
   text/plain(    (   t   selft   environt   start_responset   statust   response_headers(    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   wsgi_app   s    	c         C` s   t  t |  j   S(   N(   R   R   R   (   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   get_app   s    c         C` s&   |  j  d  } |  j | j d  d  S(   Nt   /s   Hello world!(   t   fetcht   assertEqualt   body(   R   t   response(    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   test_simple   s    (   t   __name__t
   __module__R   R   R   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR      s   		t   WSGIAdapterTestc           B` s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C` sw   d t  f d     Y} d t  f d     Y} t   < t t t t d | f d | f d t f g     SWd  QXd  S(   Nt   HelloHandlerc           B` s   e  Z d    Z RS(   c         S` s   |  j  d  d  S(   Ns   Hello world!(   t   write(   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   get!   s    (   R   R   R"   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR        s   t   PathQuotingHandlerc           B` s   e  Z d    Z RS(   c         S` s   |  j  |  d  S(   N(   R!   (   R   t   path(    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR"   %   s    (   R   R   R"   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR#   $   s   R   s
   /path/(.*)s
   /typecheck(   R   R   R   R   R   R	   R   (   R   R    R#   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR      s    
			c         C` s&   |  j  d  } |  j | j d  d  S(   NR   s   Hello world!(   R   R   R   (   R   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR   4   s    c         C` s/   |  j  d  } |  j | j d j d   d  S(   Ns   /path/foo%20bar%C3%A9u	   foo barΓ©s   utf-8(   R   R   R   t   encode(   R   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   test_path_quoting8   s    c         C` s   i d d 6} |  j  d d | } t | j  } |  j | i   |  j  d d d d d d | } t | j  } |  j | i   d  S(	   Ns   foo=bart   Cookies   /typecheck?foo=bart   headerss
   /typecheckt   methodt   POSTR   (   R   R   R   R   (   R   R(   R   t   data(    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt
   test_types<   s    !(   R   R   R   R   R&   R,   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR      s   			t   WSGIConnectionTestc           B` s   e  Z d    Z RS(   c      	   C` s6   t    ' t t t t |  j       SWd  QXd  S(   N(   R   R   R   R   R	   t   get_handlers(   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR   K   s    
(   R   R   R   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR-   J   s   c          ` sA   i  }  x4 t  j D])     f d   } |   |  d   j <q W|  S(   Nc           ` s    d  f   f d     Y  d  S(   Nt   WSGIApplicationWrappedTestc           ` s/   e  Z   f d    Z   f d   Z d   Z RS(   c         ` s0   t    |  _ |  j j   t   |   j   d  S(   N(   R   t   warning_catchert	   __enter__t   supert   setUp(   R   (   R/   (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR3   U   s    c         ` s-   t    |   j   |  j j d  d  d   d  S(   N(   R2   t   tearDownR0   t   __exit__t   None(   R   (   R/   (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR4   Z   s    c         S` s1   t  |  j   |  j    |  _ t t |  j   S(   N(   R
   R.   t   get_app_kwargst   appR   R   (   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR   ^   s    (   R   R   R3   R4   R   (    (   R/   (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR/   T   s   (    (    (   t   cls(   R/   s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   class_factoryS   s    t   WSGIApplication_(   R   t   wsgi_safe_testsR   (   t   resultR:   (    (   R9   s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   wrap_web_tests_applicationP   s
    c          C` sE   i  }  x8 t  j D]- } d | f d     Y} | |  d | j <q W|  S(   Nt   WSGIAdapterWrappedTestc           B` s   e  Z d    Z RS(   c         S` sK   t  |  j   |  j    |  _ t    t t t |  j    SWd  QXd  S(   N(   R	   R.   R7   R8   R   R   R   R   (   R   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR   m   s    
(   R   R   R   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyR?   l   s   t   WSGIAdapter_(   R   R<   R   (   R=   R9   R?   (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   wrap_web_tests_adapteri   s
    N(    t
   __future__R    R   R   t   wsgiref.validateR   t   tornado.escapeR   t   tornado.test.httpserver_testR   t   tornado.test.utilR   t   tornado.testingR   t   tornado.webR   R	   t   tornado.wsgiR
   R   R   t   tornado.testR   R   R   R   t   HTTPConnectionTestR-   R>   t   globalst   updateRA   (    (    (    s5   lib/python2.7/site-packages/tornado/test/wsgi_test.pyt   <module>   s    ,		