Ñò
?&&Lc           @   s·   d  d k  Z  d  d k l Z l Z d  d k l Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z	 e d „  ƒ Z
 e d	 „  ƒ Z e d
 „  ƒ Z e d „  ƒ Z e d „  ƒ Z d S(   iÿÿÿÿN(   t   HOSTt   PORT(   t
   wsgi_proxyc            s$   ˆ  GH‡  f d †  } ˆ  i  | _  | S(   Nc             s@   d d k  l } | i d ƒ } d t t f | i d <ˆ  | ƒ S(   Niÿÿÿÿ(   t   Requestt   /s   %s:%st   SERVER_NAME(   t   webobR   t   blankR    R   t   environ(   t   argst   kwargsR   t   req(   t   func(    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   wrapper   s    (   t	   func_name(   R   R   (    (   R   sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt
   with_webob
   s    c         C   sN   d |  _  t i ƒ  } |  i | ƒ } | i } d | j p t t | ƒ ‚ d  S(   Ns   /querys   path: /query(   t	   path_infoR   t   Proxyt   get_responset   bodyt   AssertionErrort   str(   R   t   proxyt   respR   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_001   s
    		c         C   s½   d |  _  d |  i d <d |  _ d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t	 | ƒ ‚ t i d d g ƒ } |  i | ƒ } | i
 i d	 ƒ p t | i
 ‚ d  S(
   Ns   /jsons   application/jsont   CONTENT_TYPEt   POSTs	   test postt   allowed_methodsi	   t   GETt   403(   R   R   t   methodR   R   R   R   t   content_lengthR   R   t   statust
   startswith(   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_002   s    				 c         C   s½   d |  _  d |  i d <d |  _ d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t	 | ƒ ‚ t i d d g ƒ } |  i | ƒ } | i
 i d	 ƒ p t | i
 ‚ d  S(
   Ns   /jsons   application/jsonR   t   PUTs	   test postR   i	   R   R   (   R   R   R   R   R   R   R   R   R   R   R    R!   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_003+   s    				 c         C   sc   d |  _  d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t | ƒ ‚ d  S(   Ns   /okt   HEADR   s
   text/plain(	   R   R   R   R   R   R   t   content_typeR   R   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_004:   s    			c         C   s§   d |  _  d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t | ƒ ‚ t i d d g ƒ } |  i | ƒ } | i	 i
 d ƒ p t | i	 ‚ d  S(   Ns   /deletet   DELETER   s
   text/plainR   R   (   R   R   R   R   R   R   R&   R   R   R    R!   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_005C   s    			 c         C   sc   d |  _  d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t | ƒ ‚ d  S(   Ns	   /redirectR   R   s   /complete_redirect(	   R   R   R   R   R   R   t   locationR   R   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_006P   s    			c         C   sc   d |  _  d |  _ t i d d g ƒ } |  i | ƒ } | i } | i d j p t t | ƒ ‚ d  S(   Ns   /redirect_to_urlR   R   s   /complete_redirect(	   R   R   R   R   R   R   R*   R   R   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_007Y   s    			c         C   sr   d |  _  d |  _ d |  _ t i d d g d t ƒ } |  i | ƒ } | i } | i d j p t	 t
 | ƒ ‚ d  S(   Ns   /redirect_to_urls   /nameR   R   t   strip_script_names   /name/complete_redirect(   R   t   script_nameR   R   R   t   TrueR   R   R*   R   R   (   R   R   R   R   (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   test_008b   s    				(   t   tt   _server_testR    R   t   restkit.contribR   R   R   R"   R$   R'   R)   R+   R,   R0   (    (    (    sH   /Users/benoitc/Work/couchdbkit_env/src/restkit/tests/010-test-proxies.pyt   <module>   s   	
			