î
¾?T  ã               @   sÀ   d  d l  Z d  d l j j Z d  d l Z e j d d … d k rS e j d ƒ n  d  d l	 m
 Z
 d  d l m Z d d l m Z d	 d
 „  Z d d „  Z e j d d „  ƒ Z d d „  Z d S)é    Né   é   zBroken on Python 3.3)ÚServer)ÚGatewayé   )Úurlopenc             C   s    d } d g } | | | ƒ d S)Nz200 OKúContent-typeú
text/plainzHello World!)r   r	   © )ÚenvironÚstart_responseÚstatusÚresponse_headersr
   r
   úI/home/prologic/work/circuits/tests/web/test_wsgi_gateway_multiple_apps.pyÚhello   s    	r   c             C   s    d } d g } | | | ƒ d S)Nz200 OKúContent-typeú
text/plainzFooBar!)r   r   r
   )r   r   r   r   r
   r
   r   Úfoobar   s    	r   c             C   s   i t  d 6t d 6S)Nú/z/foobar)r   r   )Úrequestr
   r
   r   Úapps   s    r   c       	      C   s  t  d ƒ } t |  ƒ j | ƒ t j | d ƒ } | j ƒ  | j ƒ  t | j j	 ƒ } | j
 ƒ  } d } | | k } | st j d | f d | | f ƒ i t j | ƒ d 6d t j ƒ  k sÍ t j | ƒ rÜ t j | ƒ n d d 6} d i | d 6} t t j | ƒ ƒ ‚ n  t } } t d j | j j	 ƒ ƒ } | j
 ƒ  } d } | | k } | sît j d | f d | | f ƒ i t j | ƒ d 6d t j ƒ  k s«t j | ƒ rºt j | ƒ n d d 6} d i | d 6} t t j | ƒ ƒ ‚ n  t } } | j ƒ  d  S)Nr   Úreadys   Hello World!ú==ú%(py0)s == %(py3)sÚpy3ÚsÚpy0Ú úassert %(py5)sÚpy5z{0:s}/foobar/s   FooBar!)r   )r   r   )r   )r   r   )r   r   ÚregisterÚpytestÚ	WaitEventÚstartÚwaitr   ÚhttpÚbaseÚreadÚ
@pytest_arÚ_call_reprcompareÚ	_safereprÚ@py_builtinsÚlocalsÚ_should_repr_global_nameÚAssertionErrorÚ_format_explanationÚNoneÚformatÚstop)	r   ÚserverÚwaiterÚfr   Ú@py_assert2Ú@py_assert1Ú@py_format4Ú@py_format6r
   r
   r   Útest#   s0    

   l   
   l   
r:   )r   r   )Úbuiltinsr+   Ú_pytest.assertion.rewriteÚ	assertionÚrewriter(   r!   ÚPYVERÚskipÚcircuits.webr   Úcircuits.web.wsgir   Úhelpersr   r   r   Úfixturer   r:   r
   r
   r
   r   Ú<module>   s     