
tSc        	   @   s  d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k l Z l Z d  d k l Z l	 Z	 l
 Z
 l Z l Z d e i f d     YZ d e i f d     YZ d e i f d	     YZ d
 e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d     YZ d   Z d Z d   Z d Z d Z d Z e e  Z e e  d  Z e e  Z d! e f d"     YZ  d# e  f d$     YZ! d S(%   iN(   t   BytesIOt   StringIO(   t   bytes_t   native_t	   text_typet   text_t   PY3t   TestRequestCommonc           B   s_  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: d9   Z; d:   Z< d;   Z= d<   Z> d=   Z? d>   Z@ d?   ZA d@   ZB dA   ZC dB   ZD dC   ZE dD   ZF dE   ZG dF   ZH dG   ZI dH   ZJ dI   ZK dJ   ZL dK   ZM dL   ZN dM   ZO dN   ZP dO   ZQ dP   ZR dQ   ZS dR   ZT dS   ZU dT   ZV dU   ZW dV   ZX dW   ZY dX   ZZ dY   Z[ dZ   Z\ d[   Z] d\   Z^ d]   Z_ d^   Z` RS(_   c         C   s   d d k  l } | S(   Ni(   t   Request(   t   webob.requestR   (   t   selfR   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   _getTargetClass   s    c         O   s   |  i    } | | |   S(   N(   R   (   R
   t   argt   kwt   cls(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   _makeOne   s    c         O   s   |  i    } | i | |   S(   N(   R   t   blank(   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   _blankOne   s    c         C   s#   |  i  t |  i h  d t   d  S(   Nt   environ_getter(   t   assertRaisest	   TypeErrorR   t   object(   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt#   test_ctor_environ_getter_raises_WTF#   s    	c         C   s   |  i  t |  i d   d  S(   N(   R   R   R   t   None(   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_ctor_wo_environ_raises_WTF'   s    c         C   s,   h  } |  i  |  } |  i | i |  d  S(   N(   R   t   assertEqualt   environ(   R
   R   t   req(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_ctor_w_environ*   s    c         C   s&   h  } |  i  t |  i | d d d  S(   Nt   charsets   latin-1(   R   t   DeprecationWarningR   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_ctor_w_non_utf8_charset/   s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns
   something:s   wsgi.url_scheme(   R   R   t   scheme(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_scheme4   s    c         C   s\   d } t  |  } h | d 6t |  d 6d d 6} |  i |  } |  i | i | j	  d  S(   Nt   inputs
   wsgi.inputt   CONTENT_LENGTHt   POSTt   REQUEST_METHOD(   R    t   lenR   t
   assertTruet	   body_file(   R
   t   bodyt   INPUTR   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_getter:   s    

c         C   sc   d } t  |  } h | d 6t |  d 6d d 6t d 6} |  i |  } |  i | i | j  d  S(   NR"   s
   wsgi.inputR#   R$   R%   s   webob.is_body_seekable(   R    R&   t   TrueR   R'   R(   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_getter_seekableD   s    

c         C   s_   d } t  |  } h | d 6t |  d 6d d 6} |  i |  } |  i | i | i j  d  S(   NR"   s
   wsgi.inputR#   R$   R%   (   R    R&   R   R'   R(   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_getter_cacheO   s    

c         C   s   d } t  |  } h | d 6d d 6} |  i |  } | i | j p t  | i | j	 p t  | i i   d j p t  d  S(   NR"   s
   wsgi.inputt   FOOR%   t    (   R    R   t   body_file_rawt   AssertionErrorR(   t   read(   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt    test_body_file_getter_unreadableY   s    c         C   s,   |  i  d  } |  i t t | d d  d  S(   Nt   /R(   t   foo(   R   R   R   t   setattr(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_setter_w_bytesb   s    	c         C   s~   t  d  } t  d  } h | d 6t d  d 6d d 6} |  i |  } | | _ |  i | i | j  |  i | i d   d  S(   Nt   beforet   afters
   wsgi.inputR#   R$   R%   (   R    R&   R   R(   R'   R   t   content_lengthR   (   R
   t   BEFOREt   AFTERR   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_setter_non_bytesg   s    

	c         C   sx   d } t  |  } h | d 6t |  d 6d d 6} |  i |  } | ` |  i | i i   d  |  i | i d  d  S(   NR"   s
   wsgi.inputR#   R$   R%   R0   i    (   R    R&   R   R(   R   t   getvalueR;   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_deleters   s    

c         C   sV   t  d  } h | d 6t d  d 6d d 6} |  i |  } |  i | i | j  d  S(   NR"   s
   wsgi.inputR#   R$   R%   (   R    R&   R   R'   R1   (   R
   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_raw   s    

c         C   s   d } t  |  } | i d d  h | d 6t d 6t |  d d 6d d 6} |  i |  } | i } |  i | | j	  |  i | i   d	  d  S(
   NR"   i   i    s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   t   nput(	   R    t   seekt   FalseR&   R   t   body_file_seekableR'   R   R?   (   R
   t   dataR*   R   R   t   seekable(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt*   test_body_file_seekable_input_not_seekable   s    

	c         C   sw   t  d  } | i d d  h | d 6t d 6t d  d d 6d d 6} |  i |  } | i } |  i | | j  d  S(	   NR"   i   i    s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   (   R    RC   R,   R&   R   RE   R'   (   R
   R*   R   R   RG   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt)   test_body_file_seekable_input_is_seekable   s    

	c         C   sA   h h d d 6d 6} |  i  |  } |  i | i h d d 6 d  S(   Nt   barR6   s   paste.urlvars(   R   R   t   urlvars(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_getter_w_paste_key   s    c         C   sG   h d h d d 6f d 6} |  i  |  } |  i | i h d d 6 d  S(   NRJ   R6   s   wsgiorg.routing_args(    (   R   R   RK   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt!   test_urlvars_getter_w_wsgiorg_key   s    c         C   sF   h  } |  i  |  } |  i | i h   |  i | d d h  f  d  S(   Ns   wsgiorg.routing_args(    (   R   R   RK   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_getter_wo_keys   s    c         C   s   h h d d 6d 6} |  i  |  } h d d 6| _ |  i | i h d d 6 |  i | d h d d 6 |  i d | j  d  S(   NRJ   R6   s   paste.urlvarst   bamt   bazs   wsgiorg.routing_args(   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_setter_w_paste_key   s    c         C   s   h d	 h d d 6f d 6h d d 6d 6} |  i  |  } h d d 6| _ |  i | i h d d 6 |  i | d d
 h d d 6f  |  i d | j  d  S(   NRJ   R6   s   wsgiorg.routing_argst   spamt   quxs   paste.urlvarsRO   RP   (    (    (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt!   test_urlvars_setter_w_wsgiorg_key   s    !c         C   sw   h  } |  i  |  } h d d 6| _ |  i | i h d d 6 |  i | d d h d d 6f  |  i d | j  d  S(   NRO   RP   s   wsgiorg.routing_argss   paste.urlvars(    (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_setter_wo_keys   s    !c         C   sm   h h d d 6d 6} |  i  |  } | ` |  i | i h   |  i d | j  |  i | d d h  f  d  S(   NRJ   R6   s   paste.urlvarss   wsgiorg.routing_args(    (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt    test_urlvars_deleter_w_paste_key   s    c         C   s   h d	 h d d 6f d 6h d d 6d 6} |  i  |  } | ` |  i | i h   |  i | d d
 h  f  |  i d | j  d  S(   Nt   at   bRJ   R6   s   wsgiorg.routing_argsRR   RS   s   paste.urlvars(   RW   RX   (   RW   RX   (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt2   test_urlvars_deleter_w_wsgiorg_key_non_empty_tuple   s    c         C   s   h d h d d 6f d 6h d d 6d 6} |  i  |  } | ` |  i | i h   |  i | d d h  f  |  i d | j  d  S(	   NRJ   R6   s   wsgiorg.routing_argsRR   RS   s   paste.urlvars(    (    (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt.   test_urlvars_deleter_w_wsgiorg_key_empty_tuple   s    c         C   s_   h  } |  i  |  } | ` |  i | i h   |  i | d d h  f  |  i d | j  d  S(   Ns   wsgiorg.routing_argss   paste.urlvars(    (   R   RK   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_deleter_wo_keys   s    c         C   s:   h h d d 6d 6} |  i  |  } |  i | i d  d  S(   NRJ   R6   s   paste.urlvars(    (   R   R   t   urlargs(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_getter_w_paste_key   s    c         C   s@   h d h d d 6f d 6} |  i  |  } |  i | i d  d  S(   NRW   RX   RJ   R6   s   wsgiorg.routing_args(   RW   RX   (   RW   RX   (   R   R   R\   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt!   test_urlargs_getter_w_wsgiorg_key   s    c         C   s?   h  } |  i  |  } |  i | i d  |  i d | j  d  S(   Ns   wsgiorg.routing_args(    (   R   R   R\   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_getter_wo_keys   s    c         C   sw   h h d d 6d 6} |  i  |  } d | _ |  i | i d  |  i | d d	 h d d 6f  |  i d | j  d  S(
   NRJ   R6   s   paste.urlvarsRW   RX   s   wsgiorg.routing_args(   RW   RX   (   RW   RX   (   RW   RX   (   R   R\   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_setter_w_paste_key  s    	c         C   sj   h d h d d 6f d 6} |  i  |  } d | _ |  i | i d  |  i | d d	 h d d 6f  d  S(
   NRJ   R6   s   wsgiorg.routing_argsRW   RX   (    (   RW   RX   (   RW   RX   (   RW   RX   (   R   R\   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt!   test_urlargs_setter_w_wsgiorg_key  s    	c         C   sb   h  } |  i  |  } d | _ |  i | i d  |  i | d d h  f  |  i d | j  d  S(   NRW   RX   s   wsgiorg.routing_argss   paste.urlvars(   RW   RX   (   RW   RX   (   RW   RX   (   R   R\   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_setter_wo_keys  s    	c         C   sg   h d h d d 6f d 6} |  i  |  } | ` |  i | i d  |  i | d d h d d 6f  d  S(	   NRW   RX   RJ   R6   s   wsgiorg.routing_args(   RW   RX   (    (    (   R   R\   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt"   test_urlargs_deleter_w_wsgiorg_key"  s    c         C   se   h d h  f d 6} |  i  |  } | ` |  i | i d  |  i d | j  |  i d | j  d  S(   Ns   wsgiorg.routing_argss   paste.urlvars(    (    (   R   R\   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt(   test_urlargs_deleter_w_wsgiorg_key_empty+  s    c         C   sX   h  } |  i  |  } | ` |  i | i d  |  i d | j  |  i d | j  d  S(   Ns   paste.urlvarss   wsgiorg.routing_args(    (   R   R\   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_deleter_wo_keys4  s    c         C   s&   |  i  h   } |  i | i h   d  S(   N(   R   R   t   cookies(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cookies_empty_environ<  s    c         C   s=   |  i  h   } | i } d | d <|  i | i d d  d  S(   Nt   1RW   (   R   Rf   R   (   R
   R   Rf   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cookies_is_mutable@  s    	
c         C   sN   h d d 6d h d d 6f d 6} |  i  |  } |  i | i h d d 6 d  S(   Ns   a=bt   HTTP_COOKIERX   RW   s   webob._parsed_cookies(   R   R   Rf   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt3   test_cookies_w_webob_parsed_cookies_matching_sourceF  s
    c         C   sU   h d d 6d h d d 6d d 6f d 6} |  i  |  } |  i | i h d d 6 d  S(	   Ns   a=bRj   s   a=b;c=dRX   RW   t   dt   cs   webob._parsed_cookies(   R   R   Rf   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt5   test_cookies_w_webob_parsed_cookies_mismatched_sourceN  s
    c         C   s   h d d 6} |  i  |  } h d d 6d d 6| _ |  i | i h d d 6d d 6 g  } | d i d  D] } | | i   ql ~ } |  i t |  d d	 g  d  S(
   Ns   a=bRj   Rh   RW   t   2RX   t   ;s   a=1s   b=2(   R   Rf   R   t   splitt   stript   sorted(   R
   R   R   t   _[1]t   xt   rcookies(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_set_cookiesV  s    
!4c         C   ss   t  d  } h | d 6t d 6t d  d 6d d 6} |  i |  } |  i | i d  |  i | i t d   d  S(   NR"   s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   (   R    R,   R&   R   R   R)   R;   (   R
   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_gettera  s    

c         C   s   t  d  } h | d 6t d 6t d  d 6d d 6} |  i |  } d  | _ |  i | i d  |  i | i d  |  i | i	  d  S(	   NR"   s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   R0   i    (
   R    R,   R&   R   R   R)   R   R;   R'   t   is_body_seekable(   R
   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_setter_Nonel  s    

	c            s2   |  i  h       f d   } |  i t |  d  S(   Nc              s   t      _ d  S(   N(   R   R)   (    (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyt   _test{  s    (   R   R   R   (   R
   R{   (    (   R   s1   /home/chrism/projects/webob/tests/test_request.pyt"   test_body_setter_non_string_raisesy  s    c         C   s   t  d  } h | d 6t d 6t d  d 6d d 6} |  i |  } d | _ |  i | i d  |  i | i t d   |  i | i  d  S(   NR9   s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   R:   (	   R    R,   R&   R   R)   R   R;   R'   Ry   (   R
   R<   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_setter_value  s    

	c         C   s   d } t  |  } h | d 6t d 6t |  d 6d d 6} |  i |  } | ` |  i | i d  |  i | i d  |  i | i  d  S(	   NR"   s
   wsgi.inputs   webob.is_body_seekableR#   R$   R%   R0   i    (	   R    R,   R&   R   R)   R   R;   R'   Ry   (   R
   RF   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_deleter_None  s    

c         C   s   d } t  |  } h | d 6t t |   d 6} |  i |  } |  i | i h d d 6 |  i | i h d d 6 h d d 6| _ |  i | i d  | ` |  i | i d	  d  S(
   Ns   {"a":1}s
   wsgi.inputR#   i   RW   i   RX   s   {"b":2}R0   (   R    t   strR&   R   R   t   jsont	   json_bodyR)   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_json_body  s     c         C   s   d } t  |  } h | d 6t t |   d 6} |  i |  } |  i | i h d d 6h d d 6g  |  i | i h d d 6h d d 6g  h d d 6g | _ |  i | i d  | ` |  i | i d	  d  S(
   Ns   [{"a":1}, {"b":2}]s
   wsgi.inputR#   i   RW   i   RX   s	   [{"b":2}]R0   (   R    R   R&   R   R   R   R   R)   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_json_body_array  s     ''c            s   d } t  |  } h | d 6t t |   d 6} |  i |    |  i   i d  |  i   i d  t d    _ |  i   i d i   i	     ` |  i   i d    f d   } |  i
 t |  d  S(   Nt   tests
   wsgi.inputR#   s   \u1000R0   c              s   d   _  d  S(   Ni   (   t   text(    (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyt   set_bad_text  s    (   R    R   R&   R   R   R)   R   R   t   encodeR   R   R   (   R
   R)   R*   R   R   (    (   R   s1   /home/chrism/projects/webob/tests/test_request.pyt   test_text_body  s     c         C   sd   d } t  |  } h | d 6t t |   d 6} |  i |  } d | _ |  i t t | d  d  S(   NR   s
   wsgi.inputR#   R0   R   (   R    R   R&   R   t   _charsetR   t   AttributeErrort   getattr(   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test__text_get_without_charset  s     	c         C   sg   d } t  |  } h | d 6t t |   d 6} |  i |  } d | _ |  i t t | d d  d  S(   NR   s
   wsgi.inputR#   R0   R   t   abc(   R    R   R&   R   R   R   R   R7   (   R
   R)   R*   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test__text_set_without_charset  s     	c         C   sh   d d k  l } h d d 6} |  i |  } | i } |  i t | |   |  i | i i d   d  S(   Ni(   t   NoVarst   GETR%   s   Not a form request(   t   webob.multidictR   R   R$   R'   t
   isinstancet   reasont
   startswith(   R
   R   R   R   t   result(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_POST_not_POST_or_PUT  s    	c         C   sm   d } t  |  } h | d 6d d 6h d d 6| f d 6} |  i |  } | i } |  i | h d d 6 d  S(   NR"   s
   wsgi.inputR$   R%   RJ   R6   s   webob._parsed_post_vars(   R    R   R$   R   (   R
   RF   R*   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_POST_existing_cache_hit  s    
	c         C   s   d d k  l } d } t |  } h | d 6d d 6} |  i |  } | i } |  i t | |   |  i | i i d   d  S(   Ni(   R   R"   s
   wsgi.inputt   PUTR%   s   Not an HTML form submission(	   R   R   R    R   R$   R'   R   R   R   (   R
   R   RF   R*   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_PUT_missing_content_type  s    

	c         C   sj   d } t  |  } h | d 6d d 6t |  d 6t d 6} |  i |  } | i } |  i | d d  d  S(	   Ns#   var1=value1&var2=value2&rep=1&rep=2s
   wsgi.inputR$   R%   R#   s   webob.is_body_seekablet   var1t   value1(   R    R&   R,   R   R$   R   (   R
   RF   R*   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_POST_missing_content_type  s    

	c         C   s   d d k  l } d } t |  } h | d 6d d 6d d 6} |  i |  } | i } |  i t | |   |  i | i i d	   d  S(
   Ni(   R   R"   s
   wsgi.inputR   R%   s
   text/plaint   CONTENT_TYPEs   Not an HTML form submission(	   R   R   R    R   R$   R'   R   R   R   (   R
   R   RF   R*   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_PUT_bad_content_type  s    

	c         C   s   d } t  |  } h | d 6t d 6d d 6d d 6t |  d 6} |  i |  } | i } |  i | d	 d	  | d
 } |  i | i d
  |  i | i d  |  i | i i	   d  d  S(   NsH  ------------------------------deb95b63e42a
Content-Disposition: form-data; name="foo"

foo
------------------------------deb95b63e42a
Content-Disposition: form-data; name="bar"; filename="bar.txt"
Content-type: application/octet-stream

these are the contents of the file "bar.txt"

------------------------------deb95b63e42a--
s
   wsgi.inputs   webob.is_body_seekableR$   R%   sF   multipart/form-data; boundary=----------------------------deb95b63e42aR   R#   R6   RJ   s   bar.txts-   these are the contents of the file "bar.txt"
(
   R    R,   R&   R   R$   R   t   namet   filenamet   fileR3   (   R
   t	   BODY_TEXTR*   R   R   R   RJ   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_POST_multipart  s    
	
c         C   s   h d d 6} |  i  |  } | i } |  i | h d d 6 d | _ | i } |  i | h d d 6 d | _ | i } |  i | h   d  S(   Ns   foo=123t   QUERY_STRINGt   123R6   s   foo=456t   456R0   (   R   R   R   t   query_string(   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_GET_reflects_query_string0  s    
					c         C   su   |  i  h   } | i } |  i | d  d | i d <| i } |  i | d  | i d =| i } |  i | d  d  S(   NR0   R   R6   s   foo=123(   R   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_GET_updates_query_string>  s    		
	c         C   s=   h d d 6} |  i  d |  } |  i | i h d d 6 d  S(   Ns   a=bRj   R5   RX   RW   (   R   R   Rf   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt$   test_cookies_wo_webob_parsed_cookiesJ  s    
c         C   s   h d d 6} |  i  d |  } | i   } x | i i   D]u \ } } | d j o |  i | | i j  q; | d j o |  i | i | | j	  q; |  i | i | |  q; Wd  S(   Ns   a=bRj   R5   R#   s   webob.is_body_seekables
   wsgi.input(   s   CONTENT_LENGTHs   webob.is_body_seekable(   R   t   copy_getR   t   itemsR'   R   (   R
   R   R   t   clonet   kt   v(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_copy_getR  s    
 c         C   s?   |  i  d  } d | _ | i   |  i t | i  t  d  S(   NR5   s   gzip,deflate(   R   t   accept_encodingt   remove_conditional_headersR   t   boolRD   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt/   test_remove_conditional_headers_accept_encoding`  s    	
c      
   C   sq   d d k  l } d d k l } |  i d  } | d d d d d d	 | | _ | i   |  i | i d   d  S(
   Ni(   t   UTC(   t   datetimeR5   i  i   i   i    t   tzinfo(   t   webob.datetime_utilsR   R   R   t   if_modified_sinceR   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt1   test_remove_conditional_headers_if_modified_sincef  s    !
c         C   sI   |  i  d  } d | _ | i p t  | i   | i p t  d  S(   NR5   R6   (   R   t   if_none_matchR2   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt-   test_remove_conditional_headers_if_none_matchn  s
    	
c         C   s?   |  i  d  } d | _ | i   |  i t | i  t  d  S(   NR5   s   foo, bar(   R   t   if_rangeR   R   R   RD   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt(   test_remove_conditional_headers_if_rangeu  s    	
c         C   s9   |  i  d  } d | _ | i   |  i | i d   d  S(   NR5   s   bytes=0-100(   R   t   rangeR   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_remove_conditional_headers_range{  s    	
c         C   s0   |  i  d d h d d 6} |  i | i  d  S(   NR5   R   R$   R%   (   R   R'   t   is_body_readable(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_body_readable_POST  s    c         C   s0   |  i  d d h d d 6} |  i | i  d  S(   NR5   R   t   PATCHR%   (   R   R'   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_body_readable_PATCH  s    c         C   s0   |  i  d d h d d 6} |  i | i  d  S(   NR5   R   R   R%   (   R   t   assertFalseR   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_body_readable_GET  s    c         C   s9   |  i  d d h d d 6} d | _ |  i | i  d  S(   NR5   R   t   WTFR%   i
   (   R   R;   R'   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt7   test_is_body_readable_unknown_method_and_content_length  s    	c         C   s7   |  i  d d h d d 6t d 6} |  i | i  d  S(   NR5   R   R   R%   s   webob.is_body_readable(   R   R,   R'   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt"   test_is_body_readable_special_flag  s    c         C   s   h d d 6} |  i  |  } | i } |  i | i h d d 6 | i i d d  | i } |  i | i h d d 6 | i i d d  | i } |  i | i h   d  S(   Ns	   max-age=5t   HTTP_CACHE_CONTROLi   s   max-ages
   max-age=10i
   R0   (   R   t   cache_controlR   t
   propertiesR   t   update(   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt#   test_cache_control_reflects_environ  s    
			c         C   s   h  } |  i  |  } d | i _ | i d } |  i | d  d | i _ | i d } |  i | d  d  | _ | i d } |  i | d  | ` |  i d | i j  d  S(   Ni   R   s	   max-age=5i
   s
   max-age=10R0   (   R   R   t   max_ageR   R   R   R'   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt"   test_cache_control_updates_environ  s    	c         C   sE   h  } |  i  |  } h d d 6| _ | i } |  i | i d  d  S(   Ni   s   max-age(   R   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cache_control_set_dict  s
    	c         C   sa   d d k  l } h  } |  i |  } | h d d 6d d | _ | i } |  i | i d  d  S(   Ni(   t   CacheControli   s   max-aget   typet   request(   t   webob.cachecontrolR   R   R   R   R   (   R
   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cache_control_set_object  s    	c         C   s2   h  } |  i  |  } |  i | i | i j  d  S(   N(   R   R'   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cache_control_gets_cached  s    c         C   sv   h  } |  i  |  } d   } | i |  \ } } } |  i | d  |  i | d g  |  i d i |  d  d  S(   Nc         S   s   | d d g  d g S(   Ns   200 OKs   content-types
   text/plains   ...
(   s   content-types
   text/plain(    (   R   t   start_response(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   application  s    s   200 OKs   content-types
   text/plainR0   s   ...
(   s   content-types
   text/plain(   R   t   call_applicationR   t   join(   R
   R   R   R   t   statust   headerst   output(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt'   test_call_application_calls_application  s    	c         C   sv   h  } |  i  |  } d   } | i |  \ } } } |  i | d  |  i | d g  |  i d i |  d  d  S(   Nc         S   s    | d d g  } | d  g  S(   Ns   200 OKs   content-types
   text/plains   ...
(   s   content-types
   text/plain(    (   R   R   t   write(    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    
s   200 OKs   content-types
   text/plainR0   s   ...
(   s   content-types
   text/plain(   R   R   R   R   (   R
   R   R   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt$   test_call_application_provides_write  s    	c         C   sn   h t  d 6} |  i |  } d   } | i |  \ } } } |  i d i |  d  |  i | d t  d  S(   Ns#   test._call_application_called_closec            s?   | d d g  } d t  f   f d     Y} | d  |   S(   Ns   200 OKs   content-types
   text/plaint   AppIterc              s    e  Z d    Z   f d   Z RS(   c         s   s	   d Vd  S(   Ns   ...
(    (   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   __iter__  s    c            s   t    d <d  S(   Ns#   test._call_application_called_close(   R,   (   R
   (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyt   close  s    (   t   __name__t
   __module__R   R   (    (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s   	s   ...
(   s   content-types
   text/plain(   R   (   R   R   R   R   (    (   R   s1   /home/chrism/projects/webob/tests/test_request.pyR     s    
R0   s   ...
...
(   RD   R   R   R   R   R,   (   R
   R   R   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt>   test_call_application_closes_iterable_when_mixed_w_write_calls  s    
		c         C   s8   h  } |  i  |  } d   } |  i t | i |  d  S(   Nc         S   s@   y t  d   Wn t i   } n X| d d g |  d g S(   Ns   OH NOESs   200 OKs   content-types
   text/plains   ...
(   s   content-types
   text/plain(   t   RuntimeErrort   syst   exc_info(   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    (   R   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_call_application_raises_exc_info  s    	c         C   s   h  } |  i  |  } d   } | i | t  \ } } } } |  i | d  |  i | d g  |  i d i |  d  |  i | d t  d  S(	   Nc         S   s@   y t  d   Wn t i   } n X| d d g |  d g S(   Ns   OH NOESs   200 OKs   content-types
   text/plains   ...
(   s   content-types
   text/plain(   R   R   R   (   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR      s    s   200 OKs   content-types
   text/plainR0   s   ...
i    (   s   content-types
   text/plain(   R   R   R,   R   R   R   (   R
   R   R   R   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_call_application_returns_exc_info  s    	c         C   s   |  i  d d h d d 6} |  i | i d  |  i  d d h d d 6d h  } |  i | i d  |  i  d d h d d 6d h  } |  i | i d  d  S(   NR5   R   R   R%   R$   t   HEAD(   R   R   t   method(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__method_subtitution0  s    c         C   s   |  i  d d h d d 6} |  i | i d  |  i | i d  |  i  d d h d d 6d d } |  i | i d  |  i | i d  d  S(   NR5   R   s   application/jsonR   R   R$   R0   (   R   R   t   content_typeR   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__ctype_in_env<  s    c         C   s   |  i  d d h d d 6} |  i | i d  |  i | i d  |  i  d d h d d 6d d } |  i | i d  |  i | i d  d  S(	   NR5   R   s   application/jsons   Content-typeR   s   Content-TypeR$   R0   (   R   R   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__ctype_in_headersG  s    c         C   s   |  i  d d d } |  i | i d  |  i | i d  |  i  d d d d d } |  i | i d  |  i | i d  d  S(   NR5   R   s   application/jsonR   R$   R0   (   R   R   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__ctype_as_kwR  s    	c         C   s&   |  i  t |  i d d d d h  d  S(   NR5   R   s   application/jsonR$   (   R   t
   ValueErrorR   (   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt/   test_blank__str_post_data_for_unsupported_ctype\  s    	c         C   s   d d k  l } |   } d | d <d | d <|  i d d | } |  i | i d  |  i | i d	  |  i | i d
  |  i | i d  d  S(   Ni(   t	   MultiDicti   t   firsti   t   secondR5   R$   s!   application/x-www-form-urlencodeds   first=1&second=2i   (   R   R   R   R   R   R   R)   R;   (   R
   R   R$   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__post_urlencodeda  s    	

c         C   s   d d k  l } |   } d | d <d | d <|  i d d | d	 d
 } |  i | i d  |  i | i d  d } |  i | i |  |  i | i d  d  S(   Ni(   R   Rh   R   Ro   R   R5   R$   R   s&   multipart/form-data; boundary=boundarys   multipart/form-datas   --boundary
Content-Disposition: form-data; name="first"

1
--boundary
Content-Disposition: form-data; name="second"

2
--boundary--i   (   R   R   R   R   R   R   R)   R;   (   R
   R   R$   R   t   expected(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__post_multipartn  s    	

	c   	      C   s  d d  k  } d d k l } d d k l } |   } d t d  f | d <d | d	 <d
 | d <|  i d d | } |  i | i d  |  i | i	 d  t
 | | i d   } | i i | d  } d } |  i | |  |  i | i d  |  i t | i d | i   |  i t | i d	 | i   |  i | i d i d  |  i | i d	 i d  |  i | i d d
  d  S(   Ni(   t   _get_multipart_boundary(   R   t	   filename1Rh   R   t	   filename2Ro   R   t   3t   thirdR5   R$   s   multipart/form-datas   content-typet   boundarys   --boundary
Content-Disposition: form-data; name="first"; filename="filename1"

1
--boundary
Content-Disposition: form-data; name="second"; filename="filename2"

2
--boundary
Content-Disposition: form-data; name="third"

3
--boundary--i&  (   R   Ro   (   t   cgiR	   R   R   R   R    R   R   R   R   R   R   R)   t   replaceR;   R'   R   R$   t   FieldStoraget   value(	   R
   R  R   R   R$   R   R  t	   body_normR   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_blank__post_files  s*    	

  c         C   s-   |  i  t |  i d d h d d 6d d d  S(	   NR5   R$   R   Rh   R   R   s!   application/x-www-form-urlencoded(   s	   filename1Rh   (   R   R   R   (   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt#   test_blank__post_file_w_wrong_ctype  s    c         C   s<   t  i d d  } |  i   } |  i t | i | d  d  S(   Ns   Content-Types!   Content-Length: 337
Content-Types   EXTRA!(   t	   _test_reqR  R   R   R   t
   from_bytes(   R
   t   _test_req_copyR   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_bytes_extra_data  s    	c         C   s   |  i    } | i t  } | i d t  } |  i | i d  d  |  i | i d d  | i    | i d  i d d  d } |  i | d  d  S(   Nt	   skip_bodys   

i    iQ  i   s   <body skipped (len=337)>iP  (   R   R
  R	  t   as_bytesR,   R   t   countRq   (   R
   R   R   R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_as_bytes_skip_body  s    "c         C   s&   |  i    } |  i t | i t  d  S(   N(   R   R   R   t   from_stringR	  (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_string_deprecated  s    c         C   s2   |  i    } | i t  } |  i t | i  d  S(   N(   R   R
  R	  R   R   t	   as_string(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_as_string_deprecated  s    (a   R   R   R   R   R   R   R   R   R   R!   R+   R-   R.   R4   R8   R>   R@   RA   RH   RI   RL   RM   RN   RQ   RT   RU   RV   RY   RZ   R[   R]   R^   R_   R`   Ra   Rb   Rc   Rd   Re   Rg   Ri   Rk   Rn   Rw   Rx   Rz   R|   R}   R~   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR      s   									
		
															
				
	
					
																																																												
				$						t   TestBaseRequestc           B   s  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: d9   Z; d:   Z< d;   Z= d<   Z> d=   Z? d>   Z@ d?   ZA d@   ZB dA   ZC dB   ZD dC   ZE dD   ZF dE   ZG dF   ZH dG   ZI dH   ZJ dI   ZK dJ   ZL dK   ZM dL   ZN dM   ZO dN   ZP dO   ZQ dP   ZR dQ   ZS dR   ZT dS   ZU dT   ZV dU   ZW RS(V   c         C   s   d d k  l } | S(   Ni(   t   BaseRequest(   R	   R  (   R
   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    c         O   s   |  i    } | | |   S(   N(   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    c         O   s   |  i    } | i | |   S(   N(   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    c         C   sL   h d d 6} |  i  |  } | i } |  i | i t  |  i | d  d  S(   Nt   OPTIONSR%   (   R   R   R   t	   __class__R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_method  s
    	c         C   s9   h d d 6} |  i  |  } | i } |  i | d  d  S(   Ns   1.1t   SERVER_PROTOCOL(   R   t   http_versionR   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_http_version  s    	c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   /scriptt   SCRIPT_NAME(   R   R   t   script_name(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_script_name  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns
   /path/infot	   PATH_INFO(   R   R   t	   path_info(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_info  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Nt   1234R#   i  (   R   R   R;   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_content_length_getter  s    c         C   s<   h d d 6} |  i  |  } d | _ |  i | i d  d  S(   NR#  R#   t   3456i  (   R   R;   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt    test_content_length_setter_w_str  s    	c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Nt   phredt   REMOTE_USER(   R   R   t   remote_user(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_remote_user  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   1.2.3.4t   REMOTE_ADDR(   R   R   t   remote_addr(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_remote_addr  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   foo=bar&baz=bamR   (   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_query_string  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   somehost.tldt   SERVER_NAME(   R   R   t   server_name(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_server_name  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Nt   6666t   SERVER_PORTi
  (   R   R   t   server_port(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_server_port_getter  s    c         C   s<   h d d 6} |  i  |  } d | _ |  i | i d  d  S(   NR2  R3  t   6667i  (   R   R4  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt#   test_server_port_setter_with_string  s    	c         C   sL   h d d 6} |  i  |  } |  i t | i t   |  i | i d  d  S(   Ns   /scriptR  (   R   R'   R   t   uscript_nameR   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_uscript_name&  s    c         C   sL   h d d 6} |  i  |  } |  i t | i t   |  i | i d  d  S(   Ns
   /path/infoR   (   R   R'   R   t
   upath_infoR   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_upath_info-  s    c         C   s[   h d d 6} |  i  |  } t d  | _ |  i t | i t   |  i | i d  d  S(   Ns
   /path/infoR   s   /another(   R   R   R:  R'   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_upath_info_set_unicode4  s
    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   application/xml+foobarR   (   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_content_type_getter_no_parameters<  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns%   application/xml+foobar;charset="utf8"R   s   application/xml+foobar(   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_content_type_getter_w_parametersB  s    c         C   sO   h d d 6} |  i  |  } d  | _ |  i | i d  |  i d | j  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R0   (   R   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_content_type_setter_w_NoneH  s
    	c         C   sP   h d d 6} |  i  |  } d | _ |  i | i d  |  i | d d  d  S(   Ns%   application/xml+foobar;charset="utf8"R   s   text/xmls   text/xml;charset="utf8"(   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt:   test_content_type_setter_existing_paramter_no_new_paramterP  s
    	c         C   sL   h d d 6} |  i  |  } | ` |  i | i d  |  i d | j  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R0   (   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt.   test_content_type_deleter_clears_environ_valueX  s
    c         C   sE   h  } |  i  |  } | ` |  i | i d  |  i d | j  d  S(   NR0   R   (   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt*   test_content_type_deleter_no_environ_value`  s
    c         C   sT   d } h | d 6d d 6} |  i  |  } | i } |  i | h | d 6d d 6 d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   s   Content-Types   Content-Length(   R   R   R   (   R
   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_headers_getterg  s    

		
c         C   sn   d } h | d 6d d 6} |  i  |  } h d d 6| _ |  i | i h d d 6 |  i | h d d 6 d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   t   Spamt   Quxt   HTTP_QUX(   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_headers_setterr  s    

c            sL   d } h | d 6d d 6} |  i  |      f d   } |  i t |  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   c              s
     `  d  S(   N(   R   (    (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyR{     s    (   R   R   R   (   R
   R   R   R{   (    (   R   s1   /home/chrism/projects/webob/tests/test_request.pyt   test_no_headers_deleter}  s    

c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.1t   HTTP_X_FORWARDED_FOR(   R   R   t   client_addr(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_client_addr_xff_singleval  s    
c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.1, 192.168.1.2RI  s   192.168.1.1(   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_client_addr_xff_multival  s    
c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.2R+  s   192.168.1.1RI  (   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_client_addr_prefers_xff  s    

c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.2R+  (   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_client_addr_no_xff  s    c         C   s,   h  } |  i  |  } |  i | i d   d  S(   N(   R   R   RJ  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_client_addr_no_xff_no_remote_addr  s    c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Nt   https   wsgi.url_schemes   example.comt	   HTTP_HOSTt   80(   R   R   t	   host_port(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_host_port_w_http_host_and_no_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:80RQ  RR  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt,   test_host_port_w_http_host_and_standard_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:8888RQ  t   8888(   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt+   test_host_port_w_http_host_and_oddball_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Nt   httpss   wsgi.url_schemes   example.comRQ  t   443(   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt,   test_host_port_w_http_host_https_and_no_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:443RQ  RY  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt2   test_host_port_w_http_host_https_and_standard_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:8888RQ  RV  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt1   test_host_port_w_http_host_https_and_oddball_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemet   4333R3  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_port_wo_http_host  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comRQ  s   http://example.com(   R   R   t   host_url(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_host_url_w_http_host_and_no_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:80RQ  s   http://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt+   test_host_url_w_http_host_and_standard_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:8888RQ  s   http://example.com:8888(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt*   test_host_url_w_http_host_and_oddball_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.comRQ  s   https://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt+   test_host_url_w_http_host_https_and_no_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:443RQ  s   https://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt1   test_host_url_w_http_host_https_and_standard_port  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:4333RQ  s   https://example.com:4333(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt0   test_host_url_w_http_host_https_and_oddball_port  s    

c         C   sA   h d d 6d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.comR/  R]  R3  s   https://example.com:4333(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_url_wo_http_host  s
    

c         C   sQ   |  i  d  } t d d  | _ | i } |  i | i t  |  i | d  d  S(   Ns   /%C3%ABs   /ës   utf-8s   http://localhost/%C3%AB(   R   R   R  t   application_urlR   R  R   (   R
   t   instt   app_url(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_application_url
  s
    	c         C   sQ   |  i  d  } t d d  | _ | i } |  i | i t  |  i | d  d  S(   Ns   /%C3%ABs   /ës   utf-8s   http://localhost/%C3%AB/%C3%AB(   R   R   R  t   path_urlR   R  R   (   R
   Rh  Ri  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_url  s
    	c         C   sQ   |  i  d  } t d d  | _ | i } |  i | i t  |  i | d  d  S(   Ns   /%C3%ABs   /ës   utf-8s   /%C3%AB/%C3%AB(   R   R   R  t   pathR   R  R   (   R
   Rh  Ri  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   test_path  s
    	c         C   sO   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   /script/path/info(   R   R   t   path_qs(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_qs_no_qs  s    

c         C   sV   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s!   /script/path/info?foo=bar&baz=bam(   R   R   Ro  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_qs_w_qs)  s    

c         C   sO   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s#   http://example.com/script/path/info(   R   R   t   url(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_url_no_qs4  s    

c         C   sV   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s3   http://example.com/script/path/info?foo=bar&baz=bam(   R   R   Rr  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_url_w_qs>  s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s
   other/pages$   http://example.com/script/other/page(   R   R   t   relative_urlR,   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt.   test_relative_url_to_app_true_wo_leading_slashJ  s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s   /other/pages   http://example.com/other/page(   R   R   Ru  R,   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt-   test_relative_url_to_app_true_w_leading_slashV  s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s   /other/pages   http://example.com/other/page(   R   R   Ru  RD   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt4   test_relative_url_to_app_false_other_w_leading_slashb  s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s
   other/pages)   http://example.com/script/path/other/page(   R   R   Ru  RD   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt5   test_relative_url_to_app_false_other_wo_leading_slashn  s    

c         C   sl   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d   |  i | d d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R0   R   (   R   t   path_info_popR   R   (   R
   R   R   t   popped(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_info_pop_emptyz  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R5   R   R0   s   /script/(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_path_info_pop_just_leading_slash  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   Rm  s   /script/paths   /info(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt'   test_path_info_pop_non_empty_no_pattern  s    

c         C   s   d d  k  } | i d  } h d d 6d d 6d d 6d	 d
 6d d 6} |  i |  } | i |  } |  i | d   |  i | d
 d	  |  i | d d  d  S(   Nit   missRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   (   t   ret   compileR   Rz  R   R   (   R
   R  t   PATTERNR   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt+   test_path_info_pop_non_empty_w_pattern_miss  s    

c         C   s   d d  k  } | i d  } h d d 6d d 6d d 6d	 d
 6d d 6} |  i |  } | i |  } |  i | d  |  i | d
 d  |  i | d d  d  S(   NiRm  RP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   /script/paths   /info(   R  R  R   Rz  R   (   R
   R  R  R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt*   test_path_info_pop_non_empty_w_pattern_hit  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s   //path/infoR   Rm  s   /script//paths   /info(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt'   test_path_info_pop_skips_empty_elements  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d   |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R0   R   (   R   t   path_info_peekR   R   (   R
   R   R   t   peeked(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_info_peek_empty  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R5   R   R0   (   R   R  R   (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_path_info_peek_just_leading_slash  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s   /pathR   Rm  (   R   R  R   (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_info_peek_non_empty  s    

c         C   s$   |  i  h   } |  i | i  d  S(   N(   R   R'   t   is_xhr(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_xhr_no_header  s    c         C   s1   h d d 6} |  i  |  } |  i | i  d  S(   Nt   notAnXMLHTTPRequestt   HTTP_X_REQUESTED_WITH(   R   R'   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_xhr_header_miss  s    c         C   s0   h d d 6} |  i  |  } |  i | i  d  S(   Nt   XMLHttpRequestR  (   R   R'   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_is_xhr_header_hit  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.com:8888RQ  (   R   R   t   host(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_getter_w_HTTP_HOST  s    c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.comR/  RV  R3  s   example.com:8888(   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_getter_wo_HTTP_HOST  s    

c         C   s6   h  } |  i  |  } d | _ |  i | d d  d  S(   Ns   example.com:8888RQ  (   R   R  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_setter  s    	c         C   s9   h d d 6} |  i  |  } | ` |  i d | j  d  S(   Ns   example.com:8888RQ  (   R   R  R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_deleter_hit  s    c         C   s   h  } |  i  |  } | ` d  S(   N(   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_deleter_miss  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.comRQ  (   R   R   t   domain(   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_domain_nocolon  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.com:8888RQ  s   example.com(   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_domain_withcolon"  s    c         C   s)   |  i  h   } |  i t | i d  d  S(   NRW   (   R   R   t   KeyErrort   encget(   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt"   test_encget_raises_without_default'  s    c         C   s/   |  i  h   } |  i | i d d   d   d  S(   NRW   (   R   R   R  R   (   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt&   test_encget_doesnt_raises_with_default+  s    c         C   sb   t  o d i d  } n d } |  i h | d 6 } |  i | i d d d t d d   d  S(   Ns   ës   latin-1RW   t   encattrt   url_encodings   utf-8(   R   t   decodeR   R   R  R   (   R
   t   valRh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_encget_with_encattr/  s    c         C   sk   t  o d i d  } n d } |  i h | d 6 } d | _ |  i | i d d d t d d   d  S(   Ns   ës   latin-1RW   R  t   my_encoding(   R   R  R   R  R   R  R   (   R
   R  Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt    test_encget_with_encattr_latin_18  s    	c         C   sS   t  o d i d  } n d } |  i h | d 6 } |  i | i d  |  d  S(   Ns   ës   latin-1RW   (   R   R  R   R   R  (   R
   R  Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_encget_no_encattrB  s
    c         C   sE   |  i  d  } | i d  } |  i | i t  |  i | d  d  S(   Ns	   /%C3%AB/cRW   s   http://localhost/%C3%AB/a(   R   Ru  R   R  R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_relative_urlJ  s    c         C   sj   t  o d i d  } n d } |  i h | d 6 } | i d } |  i | i t  |  i | d  d  S(   NR   s   latin-1t	   HTTP_FLUBt   Flub(   R   R  R   R   R   R  R   (   R
   R  Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_header_getterP  s    c         C   sY   |  i  h   } d | _ |  i | i h d d 6 h d d 6| _ |  i | i d  d  S(   Ns	   {"a":"1"}Rh   RW   Ro   s	   {"a":"2"}(   R   R)   R   R   (   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   Z  s
    	c         C   sF   |  i  h d d 6 } | i } |  i | i t  |  i | d  d  S(   Ns   example.comRQ  (   R   R  R   R  R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_geta  s    	c         C   sM   |  i  h d d 6d d 6 } | i } |  i | i t  |  i | d  d  S(   Ns   example.comR/  RR  R3  s   example.com:80(   R   R  R   R  R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_get_w_no_http_hostg  s    	(X   R   R   R   R   R   R  R  R  R"  R$  R&  R*  R-  R.  R1  R5  R7  R9  R;  R<  R=  R>  R?  R@  RA  RB  RC  RG  RH  RK  RL  RM  RN  RO  RT  RU  RW  RZ  R[  R\  R^  R`  Ra  Rb  Rc  Rd  Re  Rf  Rj  Rl  Rn  Rp  Rq  Rs  Rt  Rv  Rw  Rx  Ry  R|  R}  R~  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s   																											
																							
		
																													
			
		t   TestLegacyRequestc           B   s  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: d9   Z; d:   Z< d;   Z= d<   Z> d=   Z? d>   Z@ d?   ZA d@   ZB dA   ZC dB   ZD dC   ZE dD   ZF dE   ZG dF   ZH dG   ZI dH   ZJ dI   ZK dJ   ZL dK   ZM dL   ZN dM   ZO dN   ZP dO   ZQ dP   ZR dQ   ZS dR   ZT RS(S   c         C   s   d d k  l } | S(   Ni(   t   LegacyRequest(   R	   R  (   R
   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   o  s    c         O   s   |  i    } | | |   S(   N(   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   s  s    c         O   s   |  i    } | i | |   S(   N(   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   w  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   NR  R%   (   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  {  s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   1.1R  (   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   /scriptR  (   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns
   /path/infoR   (   R   R   R!  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR"    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   NR#  R#   i  (   R   R   R;   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR$    s    c         C   s<   h d d 6} |  i  |  } d | _ |  i | i d  d  S(   NR#  R#   R%  i  (   R   R;   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR&    s    	c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   NR'  R(  (   R   R   R)  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR*    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   1.2.3.4R+  (   R   R   R,  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR-    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   foo=bar&baz=bamR   (   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR.    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   somehost.tldR/  (   R   R   R0  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR1    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   NR2  R3  i
  (   R   R   R4  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR5    s    c         C   s<   h d d 6} |  i  |  } d | _ |  i | i d  d  S(   NR2  R3  R6  i  (   R   R4  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR7    s    	c         C   se   h d d 6} |  i  |  } |  i t | i t   | i } |  i | i t  |  i | d  d  S(   Ns   /scriptR  (   R   R'   R   R8  R   R   R  (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR9    s    	c         C   sO   h d d 6} |  i  |  } | i } |  i t | t   |  i | d  d  S(   Ns
   /path/infoR   (   R   R:  R'   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR;    s
    	c         C   s^   h d d 6} |  i  |  } t d  | _ | i } |  i t | t   |  i | d  d  S(   Ns
   /path/infoR   s   /another(   R   R   R:  R'   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR<    s    	c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   application/xml+foobarR   (   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR=    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns%   application/xml+foobar;charset="utf8"R   s   application/xml+foobar(   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR>    s    c         C   sO   h d d 6} |  i  |  } d  | _ |  i | i d  |  i d | j  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R0   (   R   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR?    s
    	c         C   sP   h d d 6} |  i  |  } d | _ |  i | i d  |  i | d d  d  S(   Ns%   application/xml+foobar;charset="utf8"R   s   text/xmls   text/xml;charset="utf8"(   R   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR@    s
    	c         C   sL   h d d 6} |  i  |  } | ` |  i | i d  |  i d | j  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R0   (   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRA    s
    c         C   sE   h  } |  i  |  } | ` |  i | i d  |  i d | j  d  S(   NR0   R   (   R   R   R   R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRB    s
    c         C   sT   d } h | d 6d d 6} |  i  |  } | i } |  i | h | d 6d d 6 d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   s   Content-Types   Content-Length(   R   R   R   (   R
   R   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRC  
  s    

		
c         C   s   d } h | d 6d d 6} |  i  |  } h d d 6| _ |  i | i h d d 6 |  i | d t d   |  i | h d d 6 d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   RD  RE  RF  (   R   R   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRG    s    

c            sL   d } h | d 6d d 6} |  i  |      f d   } |  i t |  d  S(   Ns%   application/xml+foobar;charset="utf8"R   R   R#   c              s
     `  d  S(   N(   R   (    (   R   (    s1   /home/chrism/projects/webob/tests/test_request.pyR{   '  s    (   R   R   R   (   R
   R   R   R{   (    (   R   s1   /home/chrism/projects/webob/tests/test_request.pyRH  !  s    

c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.1RI  (   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRK  +  s    
c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.1, 192.168.1.2RI  s   192.168.1.1(   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRL  2  s    
c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.2R+  s   192.168.1.1RI  (   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRM  9  s    

c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   192.168.1.2R+  (   R   R   RJ  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRN  @  s    c         C   s,   h  } |  i  |  } |  i | i d   d  S(   N(   R   R   RJ  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRO  F  s    c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comRQ  RR  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRT  K  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:80RQ  RR  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRU  R  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:8888RQ  RV  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRW  Y  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.comRQ  RY  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRZ  `  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:443RQ  RY  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR[  g  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:8888RQ  RV  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR\  n  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemeR]  R3  (   R   R   RS  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR^  u  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comRQ  s   http://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR`  |  s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:80RQ  s   http://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRa    s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.com:8888RQ  s   http://example.com:8888(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRb    s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.comRQ  s   https://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRc    s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:443RQ  s   https://example.com(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRd    s    

c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.com:4333RQ  s   https://example.com:4333(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRe    s    

c         C   sA   h d d 6d d 6d d 6} |  i  |  } |  i | i d  d  S(   NRX  s   wsgi.url_schemes   example.comR/  R]  R3  s   https://example.com:4333(   R   R   R_  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRf    s
    

c         C   sP   |  i  d  } d | _ | i } t o |  i | d  n |  i | d  d  S(   Ns   /%C3%ABs   /ës   http://localhost/%C3%83%C2%ABs   http://localhost/%C3%AB(   R   R  Rg  R   R   (   R
   Rh  Ri  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRj    s    		c         C   sP   |  i  d  } d | _ | i } t o |  i | d  n |  i | d  d  S(   Ns   /%C3%ABs   /ës*   http://localhost/%C3%83%C2%AB/%C3%83%C2%ABs   http://localhost/%C3%AB/%C3%AB(   R   R  Rk  R   R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRl    s    			c         C   sP   |  i  d  } d | _ | i } t o |  i | d  n |  i | d  d  S(   Ns   /%C3%ABs   /ës   /%C3%83%C2%AB/%C3%83%C2%ABs   /%C3%AB/%C3%AB(   R   R  Rm  R   R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRn    s    		c         C   sO   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   /script/path/info(   R   R   Ro  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRp    s    

c         C   sV   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s!   /script/path/info?foo=bar&baz=bam(   R   R   Ro  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRq    s    

c         C   sO   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s#   http://example.com/script/path/info(   R   R   Rr  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRs    s    

c         C   sV   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s3   http://example.com/script/path/info?foo=bar&baz=bam(   R   R   Rr  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRt    s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s
   other/pages$   http://example.com/script/other/page(   R   R   Ru  R,   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRv    s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s   /other/pages   http://example.com/other/page(   R   R   Ru  R,   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRw    s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s   /other/pages   http://example.com/other/page(   R   R   Ru  RD   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRx    s    

c         C   s_   h d d 6d d 6d d 6d d 6d	 d
 6d d 6} |  i  |  } |  i | i d t  d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   foo=bar&baz=bamR   s
   other/pages)   http://example.com/script/path/other/page(   R   R   Ru  RD   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyRy    s    

c         C   sl   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d   |  i | d d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R0   R   (   R   Rz  R   R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR|  (  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R5   R   R0   s   /script/(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR}  4  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   Rm  s   /script/paths   /info(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR~  A  s    

c         C   s   d d  k  } | i d  } h d d 6d d 6d d 6d	 d
 6d d 6} |  i |  } | i |  } |  i | d   |  i | d
 d	  |  i | d d  d  S(   NiR  RP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   (   R  R  R   Rz  R   R   (   R
   R  R  R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  N  s    

c         C   s   d d  k  } | i d  } h d d 6d d 6d d 6d	 d
 6d d 6} |  i |  } | i |  } |  i | d  |  i | d
 d  |  i | d d  d  S(   NiRm  RP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s
   /path/infoR   s   /script/paths   /info(   R  R  R   Rz  R   (   R
   R  R  R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  ]  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s   //path/infoR   Rm  s   /script//paths   /info(   R   Rz  R   (   R
   R   R   R{  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  l  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d   |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R0   R   (   R   R  R   R   (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  y  s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  R5   R   R0   (   R   R  R   (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    

c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  |  } | i   } |  i | d  |  i | d d  |  i | d
 d	  d  S(   NRP  s   wsgi.url_schemes   example.comR/  RR  R3  s   /scriptR  s   /pathR   Rm  (   R   R  R   (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    

c         C   s$   |  i  h   } |  i | i  d  S(   N(   R   R'   R  (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s1   h d d 6} |  i  |  } |  i | i  d  S(   NR  R  (   R   R'   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s0   h d d 6} |  i  |  } |  i | i  d  S(   NR  R  (   R   R'   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s3   h d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.com:8888RQ  (   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s:   h d d 6d d 6} |  i  |  } |  i | i d  d  S(   Ns   example.comR/  RV  R3  s   example.com:8888(   R   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    

c         C   s6   h  } |  i  |  } d | _ |  i | d d  d  S(   Ns   example.com:8888RQ  (   R   R  R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    	c         C   s9   h d d 6} |  i  |  } | ` |  i d | j  d  S(   Ns   example.com:8888RQ  (   R   R  R'   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s   h  } |  i  |  } | ` d  S(   N(   R   R  (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s)   |  i  h   } |  i t | i d  d  S(   NRW   (   R   R   R  R  (   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s/   |  i  h   } |  i | i d d   d   d  S(   NRW   (   R   R   R  R   (   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   sb   t  o d i d  } n d } |  i h | d 6 } |  i | i d d d t d d   d  S(   Ns   ës   latin-1RW   R  R  (   R   R  R   R   R  R   (   R
   R  Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s\   t  o d i d  } n d } |  i h | d 6 } |  i | i d  t d d   d  S(   Ns   ës   latin-1RW   (   R   R  R   R   R  R   (   R
   R  Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s
    c         C   sM   |  i  d  } | i d  } t o |  i | d  n |  i | d  d  S(   Ns	   /%C3%AB/cRW   s   http://localhost/%C3%83%C2%AB/as   http://localhost/%C3%AB/a(   R   Ru  R   R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s
    c         C   sW   t  o d i d  } n d } |  i h | d 6 } | i d } |  i | d  d  S(   NR   s   latin-1R  R  (   R   R  R   R   R   (   R
   R  Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    c         C   s6   |  i  h   } d | _ |  i | i h d d 6 d  S(   Ns	   {"a":"1"}Rh   RW   (   R   R)   R   R   (   R
   Rh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR     s    	c         C   s3   |  i  h d d 6 } | i } |  i | d  d  S(   Ns   example.comRQ  (   R   R  R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_get_w_http_host  s    	c         C   s:   |  i  h d d 6d d 6 } | i } |  i | d  d  S(   Ns   example.comR/  RR  R3  s   example.com:80(   R   R  R   (   R
   Rh  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   	  s    	(U   R   R   R   R   R   R  R  R  R"  R$  R&  R*  R-  R.  R1  R5  R7  R9  R;  R<  R=  R>  R?  R@  RA  RB  RC  RG  RH  RK  RL  RM  RN  RO  RT  RU  RW  RZ  R[  R\  R^  R`  Ra  Rb  Rc  Rd  Re  Rf  Rj  Rl  Rn  Rp  Rq  Rs  Rt  Rv  Rw  Rx  Ry  R|  R}  R~  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  m  s   																													
																				
		
	
		
																																	t   TestRequestConstructorWarningsc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   d d k  l } | S(   Ni(   R   (   R	   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   	  s    c         O   s   |  i    } | | |   S(   N(   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   
	  s    c         C   si   t  i d t  i i   } z- | ~ } t  i d  |  i h  d t Wd  QX|  i t |  d  d  S(   Nt   recordt   alwayst   unicode_errorsi   (	   t   warningst   catch_warningsR,   t   __exit__t	   __enter__t   simplefilterR   R   R&   (   R
   Rt   t   w(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_ctor_w_unicode_errors	  s    )c         C   si   t  i d t  i i   } z- | ~ } t  i d  |  i h  d t Wd  QX|  i t |  d  d  S(   NR  R  t   decode_param_namesi   (	   R  R  R,   R  R  R  R   R   R&   (   R
   Rt   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_ctor_w_decode_param_names	  s    )(   R   R   R   R   R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  	  s   			t   TestRequestWithAdhocAttrc           B   sG   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         O   s    d d k  l } | i | |   S(   Ni(   R   (   R	   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   	  s    c         C   s:   |  i  d  } d | _ |  i | i d h d d 6 d  S(   NR5   i   s   webob.adhoc_attrsR6   (   R   R6   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_set!	  s    	c         C   s@   |  i  d d h h  d 6} d | _ |  i | i d h   d  S(   NR5   R   s   webob.adhoc_attrsi   (   R   t   request_body_tempfile_limitR   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_set_nonadhoc&	  s    	c         C   s:   |  i  d d h h d d 6d 6} |  i | i d  d  S(   NR5   R   i   R6   s   webob.adhoc_attrs(   R   R   R6   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_get+	  s    #c         C   s)   |  i  d  } |  i t t | d  d  S(   NR5   t	   some_attr(   R   R   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_get_missing/	  s    c         C   sD   |  i  d d h h d d 6d 6} | ` |  i | i d h   d  S(   NR5   R   i   R6   s   webob.adhoc_attrs(   R   R6   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_del3	  s    #c         C   s)   |  i  d  } |  i t t | d  d  S(   NR5   R  (   R   R   R   t   delattr(   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_adhoc_attrs_del_missing8	  s    (	   R   R   R   R  R  R  R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  	  s   						t   TestRequest_functionalc           B   s	  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: RS(9   c         C   s   d d k  l } | S(   Ni(   R   (   R	   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   >	  s    c         O   s   |  i    } | | |   S(   N(   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   B	  s    c         O   s   |  i    } | i | |   S(   N(   R   R   (   R
   R   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   F	  s    c         C   s   |  i  d  } | i t  \ } } } |  i | d  d i |  } |  i d | j  |  i d | j  |  i d | j  d  S(   NR5   s   200 OKR0   t   Hellos   MultiDict([])s$   post is <NoVars: Not a form request>(   R   R   t	   simpleappR   R   R'   (   R
   R   R   t
   headerlistt   app_itert   res(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   test_getsJ	  s    c         C   s   |  i  d  } | i t  \ } } } d i |  } |  i d | j  |  i d | j  |  i d | j  |  i d | j  d  S(   Ns   /?name=georgeR0   R   s   'name's   'george's   Val is (   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_gets_with_query_stringS	  s    c         C   sM   |  i  d  } | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R0   s   The languages are: [](   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_language_parsing1\	  s    c         C   sZ   |  i  d d h d d 6} | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R   s   da, en-gb;q=0.8s   Accept-LanguageR0   s   languages are: ['da', 'en-gb'](   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_language_parsing2b	  s
    c         C   sZ   |  i  d d h d d 6} | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R   s   en-gb;q=0.8, das   Accept-LanguageR0   s   languages are: ['da', 'en-gb'](   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_language_parsing3i	  s    c         C   sZ   |  i  d d h d d 6} | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R   s	   text/htmlt   AcceptR0   s   accepttypes is: text/html(   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_mime_parsing1q	  s    c         C   sZ   |  i  d d h d d 6} | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R   s   application/xmlR  R0   s   accepttypes is: application/xml(   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_mime_parsing2y	  s    c         C   sZ   |  i  d d h d d 6} | i t  \ } } } d i |  } |  i d | j  d  S(   NR5   R   s   application/xml,*/*R  R0   s   accepttypes is: application/xml(   R   R   R  R   R'   (   R
   R   R   R  R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_mime_parsing3	  s    c         C   sQ  |  i  d  i } |  i |  |  i |  i  d d h d d 6i  |  i  d d h d d 6} |  i | i  |  i t | i i d g  |  i  d d d d g } |  i | i i d	 d g  d  |  i | i i d d	 g  d  |  i  d d d d
 g } |  i | i i d d g  d  |  i | i i d d g  d  d  S(   NR5   R   R0   R  s
   text/plains   */*t   accepts   text/*s   application/x-foos	   message/*s   message/x-foo(   R   R  R'   R   R   t
   best_matchR   (   R
   R  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_accept_best_match	  s(    'c         C   s  d d g } d d d d d g } xL | D]D \ } } |  i  d d h | d	 6} |  i | i i |  |  q( Wd d
 g } d d g } xL | D]D \ } } |  i  d d h | d	 6} |  i | i i |  |  q Wd d g } d d g } xL | D]D \ } } |  i  d d h | d	 6} |  i | i i |  |  q Wd d g } d d d  g } xE | D]= \ } } |  i  d d | } |  i | i i |  |  q`Wd  S(!   Ns   application/xbel+xmls   application/xmls   application/xbel+xml; q=1s   application/xml; q=1s   application/*; q=1s   */*R5   R   R  s   text/xmls   text/*;q=0.5,*/*; q=0.1s%   text/html,application/atom+xml; q=0.9s   application/jsons	   text/htmls&   application/json, text/javascript, */*s!   application/json, text/html;q=0.9s	   image/pngs   image/*s   image/*, application/xmlR  (   s   application/xbel+xmls   application/xbel+xml(   s   application/xbel+xml; q=1s   application/xbel+xml(   s   application/xml; q=1s   application/xml(   s   application/*; q=1s   application/xbel+xml(   s   */*s   application/xbel+xml(   s   text/*;q=0.5,*/*; q=0.1s   text/xml(   s%   text/html,application/atom+xml; q=0.9N(   s&   application/json, text/javascript, */*s   application/json(   s!   application/json, text/html;q=0.9s   application/json(   s	   image/pngs	   image/png(   s   image/*s	   image/png(   s   image/*, application/xmls   application/xml(   R   R   R  R  R   (   R
   t	   supportedt   testsR  t   getR   t   offered(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_mimeparse	  s@    	  	  	  	 c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6} |  i  d d | } | i t  \ } } } d i |  } xL d d d d d d d d d d d d f D] } |  i t |  | j  q Wd  S(   Ns   Sat, 29 Oct 1994 19:43:31 GMTs   If-Modified-Sinces   var1=value1t   Cookies   Mozilla 4.0 (compatible; MSIE)s
   User-Agents   "etag001", "etag002"s   If-None-MatchR  s   X-Requested-Withs   /?foo=bar&bazR   R0   s   if_modified_since: s7   datetime.datetime(1994, 10, 29, 19, 43, 31, tzinfo=UTC)s   user_agent: 'Mozillas   is_xhr: Trues   cookies is <RequestCookiesR   R   s   params is NestedMultiDictR6   RJ   RP   s(   if_none_match: <ETag etag001 or etag002>(   R   R   R  R   R'   R   (   R
   R   R   R   R  R  R  t   thing(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_headers	  s0    
 c         C   s   |  i  d  } d | i d <|  i | i h   d | i d <|  i | i h d d 6 d | i d <|  i | i h   d | i d <|  i | i h   d	 | i d <|  i | i h d
 d 6d d 6d d 6d d 6 d | i d <|  i | i h d d 6 d  S(   NR5   s   070-it-:><?0R  s   foo=barRJ   R6   s   ...s   =foosI   dismiss-top=6; CP=null*; PHPSESSID=0a539d42abc001cdc762809248d4beed; a=42s   null*t   CPt    0a539d42abc001cdc762809248d4beedt	   PHPSESSIDt   42RW   t   6s   dismiss-tops   fo234{=bar blub=Blaht   Blaht   blub(   R   R   R   Rf   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_bad_cookie	  s"    c         C   s:   |  i  d  } d | i d <|  i | i h d d 6 d  S(   NR5   s   foo="?foo"; Path=/R  s   ?fooR6   (   R   R   R   Rf   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cookie_quoting	  s    c         C   sE   d } |  i  |  } |  i | i |  |  i | i i |   d  S(   Ns   /:@&+$,/bar(   R   R   Rm  R'   Rr  t   endswith(   R
   Rm  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_quoting	  s    c         C   s  |  i  d  } d | _ d | _ |  i t | i i    d d d g  | i i   } |  i t | i    d d d g  d	 | d <|  i t | i    d d g  |  i  d
  } t d d  } |  i	 | t | i
 i    j  |  i | i
 | d  d  S(   Ns	   /?a=1&b=2R$   s   b=3RW   Rh   RX   Ro   R   t   4s   /?%E1%80%80=xs   \u1000t   unicode_escapeRu   (   RW   Rh   (   RX   Ro   (   RX   R   (   RW   Rh   (   RX   Ro   (   RX   R   (   RW   Rh   (   RX   R  (   R   R   R)   R   t   listt   paramsR   t   copyR   R'   R   t   keys(   R
   R   t
   new_paramsR  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_params
  s    		
""c         C   s
  |  i  d d d d d d d } | i } | i   |  i | i | j	  |  i  d d d d t d	  d
 d } |  i t | i d   | i } | i   |  i | i | j	  |  i | i d	  | i	 } | i   |  i | i | j  |  i | i	 | j  d  S(   NR5   R   R$   R)   s	   some textR  i   R(   t
   0123456789R;   i
   RC   (
   R   R1   t	   copy_bodyR'   t   UnseekableInputt   hasattrt   make_body_seekableR   R)   R(   (   R
   R   t   old_body_file(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_copy_body
  s     		
	
	
c         C   s   |  i  d d d d t d  d d } |  i t | i d   |  i t | i i d	  | i } | i	   } |  i | i | i j o
 | j	 n  |  i
 | i d  d  S(
   NR5   R   R$   R(   R  R;   i
   RC   i    (   R   t   UnseekableInputWithSeekR'   R  R1   R   t   IOErrorRC   R(   R  R   R)   (   R
   R   R  t   req2(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_broken_seek'
  s    		c         C   s   |  i  d d d d d } |  i | i  |  i | i d  |  i | i d  | ` |  i | i d  |  i | i d  d  S(	   NR5   R   R   R)   R6   i   R0   i    (   R   R'   Ry   R   R)   R;   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_set_body4
  s    c         C   s-   |  i  d  } d | i d <| i i   d  S(   NR5   t   0t   HTTP_CONTENT_LENGTH(   R   R   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_broken_clen_header=
  s    c         C   s-   |  i  d  } d | i d <| i i   d  S(   NR5   i   (   R   R   R   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_nonstr_keysD
  s    c         C   s<   |  i  d  } d | _ |  i | i d h d d 6f  d  S(   NR5   s   Digest uri="/?a=b"t   Digests   /?a=bt   uri(   R   t   authorizationR   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_authorizationJ
  s    	c         C   sx   |  i  d  } t | i    } |  i | |  |  i  d  } d | _ d | _ t | i    } |  i | |  d  S(   Ns(   http://example.com:8000/test.html?paramss   http://example.com/test2R$   s   test=example(   R   R    R  t	   equal_reqR   R)   (   R
   R   t   inp(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_as_bytesO
  s    		c         C   sx   |  i  d  } t | i    } |  i | |  |  i  d  } d | _ d | _ t | i    } |  i | |  d  S(   Ns(   http://example.com:8000/test.html?paramss   http://example.com/test2R$   s   test=example(   R   R   t   as_textR  R   R)   (   R
   R   R	  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_as_textZ
  s    		c         C   sE   |  i  h  d d  } |  i d | i j  |  i d | i j  d  S(   NR;   s   content-lengths   content-type(   R   R   R'   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_req_kw_none_vale
  s    c         C   sC   |  i  d  } | i d =|  i | i d  |  i | i d  d  S(   NR5   R  R0   (   R   R   R   R  R8  (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_env_keysj
  s    
c         C   s0   d d k  l } | } |  i t |  d  d  S(   Ni(   t	   NoDefaults   (No Default)(   R	   R  R   t   repr(   R
   R  t   nd(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_repr_nodefaultq
  s    c         C   s   |  i  t |  i d d  d  S(   NR   (   R   R   R   R   (   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_request_noenviron_paramv
  s    c         C   s_   |  i  t |  i h d d 6d d |  i h d d 6d d } |  i t | d d   d  d  S(   Ni   RW   t   this_does_not_existR0  s	   127.0.0.1(   R   R   R   R   R   R   (   R
   t   r(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_unexpected_kwz
  s    	c         C   s   |  i  h d d 6h d d 6 } |  i d | i j  |  i t | d   | ` |  i d | i j  |  i  h d d 6d d } |  i | i d d j  d | _ |  i | i d d j  d  S(   Ni   RW   s	   text/htmlR   R   s-   charset=utf-8;application/atom+xml;type=entrys   charset=utf-8(   R   R'   R   R  R   (   R
   R  RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_conttype_set_del
  s     	
	c         C   s   h d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6} |  i  h d d 6d | } xP | i   D]B } |  i | | i j o# d | i   i d d  | i j  q` Wh d d 6| _ |  i t | i i    t d d g   d  S(   Ns   www.example.comt   Hosts   en-us,en;q=0.5s   Accept-Languages   gzip,deflates   Accept-Encodings   ISO-8859-1,utf-8;q=0.7,*;q=0.7s   Accept-Charsett   115s
   Keep-Alives
   keep-alivet
   Connections	   max-age=0s   Cache-Controli   RW   R   t   HTTP_t   -t   _t   Apachet   Servert   HTTP_SERVER(	   R   R  R'   R   t   upperR  R   R   t   set(   R
   R   R  t   i(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_headers2
  s    

 *c         C   s   |  i  h d d 6h d d 6 } |  i | i d  |  i  h d d 6h d d 6d d	 6 } |  i | i d
  |  i  h d d 6h d d 6d d	 6 } |  i | i d  d  S(   NRP  s   wsgi.url_schemes   www.example.comR  s   http://www.example.comt	   localhostR0  i  R4  s   http://localhost:5000RX  i  s   https://localhost(   R   R   R_  (   R
   RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_url
  s    c         C   s   |  i  h d d 6h d d 6d d 6 } |  i | i   d  |  i | i   d  |  i | i   d  |  i | i   d  |  i | i   d   |  i | i   d   d  S(	   Ni   RW   s   /foo/barR!  R0   R  R6   RJ   (   R   R   R  Rz  R   (   R
   RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_path_info_p
  s    'c         C   s  |  i  h d	 h d d 6f d 6h d d 6d 6 } h d d 6| _ |  i d | i j  |  i | i d d
 h d d 6f  | ` |  i d | i j  |  i  h h d d 6d 6 } |  i | i h d d 6 h d d 6| _ |  i | i d h d d 6 | ` |  i d | i j  d  S(   Nt   yRu   s   wsgiorg.routing_argsR  R   s   paste.urlvarst   worldt   hello(    (    (   R   RK   R'   R   R   (   R
   RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlvars_property
  s    c         C   s   |  i  h h d d 6d 6 } |  i | i d	  h d d 6| _ |  i | i d h d d 6h d d 6f  |  i  h d d 6 } h d d 6| _ |  i | i d h d d 6h  f  | ` |  i d | i j  d  S(
   NR  R   s   paste.urlvarsR)  R*  s   wsgiorg.routing_argsi   RW   (    (   R   R   R\   R   R'   (   R
   RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_urlargs_property
  s    c         C   st   |  i  h d d 6d d d d } |  i | i d  d | _ |  i d | i j  | ` |  i d | i j  d  S(	   NRP  s   wsgi.url_schemeR0  R%  R4  i  s   localhost:5000RQ  (   R   R   R  R'   R   (   R
   RW   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_host_property
  s    		c      	   C   s  d d  k  } d t f d     Y} |  i   } | i } | t | i  d } |  i h d d 6d d 6d | t | i  |  } |  i t | i	  t | i |  d  |  i
 t t | d	 t d
   d  | _	 |  i | i	 d  |  i h d d 6d d d | t | i   } |  i t | i d   | i   |  i t | i d   |  i h d d 6d d d t t | i   } |  i t | i d   | i   |  i t | i d   d  S(   Nit   DummyIOc           B   s   e  Z d    Z d d  Z RS(   c         S   s   | |  _  d  S(   N(   t   txt(   R
   R/  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   __init__
  s    ic         S   s   |  i  d | !S(   Ni    (   R/  (   R
   t   n(    (    s1   /home/chrism/projects/webob/tests/test_request.pyR3   
  s    (   R   R   R0  R3   (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR.  
  s   	i   RW   R$   R%   R(   R)   s   hello worldR0   R   R   RC   (   t   stringR   R   R  R&   t   ascii_lettersR   R   R   R)   R   R   R7   R   R   R'   R  R1   R  R    (   R
   R2  R.  R   t   limitt   len_strlR  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_property
  s.    
	*		

c         C   s=   |  i  h d d 6d d 6 } |  i t |  i d   d  S(   NR   R#   R0   R)   s   (invalid WSGI environ)>(   R   R'   R  R  (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_repr_invalid  s    c         C   s   t  d  } |  i   } |  i t | i |  t  d  } | i |  } |  i t | |   |  i t |  i d   t  d  } |  i t | i |  d  S(   Ns   hello worlds  GET /webob/ HTTP/1.1
Host: pythonpaste.org
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13)Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
s   (invalid WSGI environ)>s*   GET /webob/ HTTP/1.1
Host pythonpaste.org
(	   R    R   R   R   t	   from_fileR'   R   R  R  (   R
   t   ioR   t   val_fileR   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_garbage_file  s    		c         C   s  d d  k  } |  i   } | i t  } |  i t | |   |  i t |  i d   |  i d | i j p d | i j  |  i d | i	 j  |  i | i
 d  j	  |  i | i
 d  |  i d | i j  d } |  i | | i j  |  i | i d d  | i d	 } |  i t | | i   |  i | i d
  | i i d  |  i | i i   |  t i d d  } |  i | i   |  | i t  } |  i d | i j  |  i | i   t i    |  i t | i t d  d  S(   Nis   (invalid WSGI environ)>s   
s   t   ,iQ  R6   s.   these are the contents of the file 'bar.txt'
RJ   s   application/octet-streami    s   Content-Types!   Content-Length: 337
Content-TypeR  t   xx(   R  R   R
  R	  R'   R   R  R  R  R  R;   R   R   R)   R  R  R   R   RC   R3   R  R  t
   _test_req2R   t   rstripR   R   (   R
   R  R   R   t   bar_contentsRJ   R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_bytes4  s6    	c         C   s  d d  k  } |  i   } | i t t d   } |  i t | |   |  i t |  i d   |  i d | i	 j p d | i	 j  |  i d | i
 j  |  i | i d  j	  |  i | i d  |  i d | i j  d	 } |  i | | i j  |  i | i d d  | i d
 } |  i t | | i   |  i | i d  | i i d  |  i | i i   |  t i d d  } |  i | i   |  | i t  } |  i d | i j  |  i | i   t i    |  i t | i t d  d  S(   Nis   utf-8s   (invalid WSGI environ)>s   
s   R<  iQ  R6   s.   these are the contents of the file 'bar.txt'
RJ   s   application/octet-streami    s   Content-Types!   Content-Length: 337
Content-TypeR  R=  (   R  R   t	   from_textR   R	  R'   R   R  R  R  R  R;   R   R   R)   R  R  R   R   RC   R3   R  R  R
  R>  R   R?  R   R   (   R
   R  R   R   R@  RJ   R  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_from_textX  s6    	c         C   s  |  i  t |  i d d  d  |  i  t |  i d d  d  |  i d d  d  } |  i | i i d d   d  |  i | i i d d   d  |  i | i i d	 d   d
  |  i | i i d d   d  |  i d d  d  } |  i | i i d d   d  |  i | i i d d   d  |  i | i i d	 d   d
  |  i | i i d d   d  |  i | i i d d   d  |  i | i i d d   d  |  i | i i d d   d  d  S(   Ns   www.example.com/foo?hello=worlds"   gopher.example.com/foo?hello=worlds   gopher://gopher.example.coms   http://www.example.comRQ  s   www.example.com:80R   s   www.example.com/fooR   s   hello=worldR%   R   s"   www.example.com/secure?hello=worlds   https://www.example.com/secures   www.example.com:443s   www.example.com/secureR  s   /secureR/  s   www.example.comR3  RY  (   R   R   R   R   R   R   R  (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt
   test_blanky  s6    		c         C   s   |  i  d d d d t } | i } | i } | i } |  i | | j	  | i } | i } |  i | | j  |  i | | j  d  S(   NR5   R   s&   multipart/form-data; boundary=boundaryR$   (   R   t   _cgi_escaping_bodyR1   R$   R'   (   R
   R   t   f0t   post1t   f1t   post2t   f2(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_post_does_not_reparse  s    						c            ss   d       f d   }   i  d d d d d } | i |  }   i | i d    i | i d d  d  S(	   Nc         S   s   | d g   |  d i    g S(   Ns   200 OKs
   wsgi.input(   R3   (   t   envt   sr(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   app  s    c            sG     i  |   } | i i   } | i   } | | i d <| |  |  S(   Ns   x-data(   R   R(   R3   t   get_responseR   (   RL  RM  R   RF   t   resp(   R
   RN  (    s1   /home/chrism/projects/webob/tests/test_request.pyt   mw  s
    R5   R   R   R)   R   s   x-data(   R   RO  R   R)   R   (   R
   RQ  R   RP  (    (   R
   RN  s1   /home/chrism/projects/webob/tests/test_request.pyt   test_middleware_body  s    	c         C   sk   |  i  d d d d d } g  } t d  D] } | | i i d  q, ~ } |  i | d d	 d
 g  d  S(   NR5   R   R   R)   R   i   i   RW   RX   Rm   (   R   R   R(   R3   R   (   R
   R   Rt   R#  t   lst(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_noseek  s    3c         C   sp   |  i  d d d d t } |  i t | i i    d g  | i i   |  i t | i i    d g  d  S(   NR5   R   s&   multipart/form-data; boundary=boundaryR$   s   %20%22"(   R   RE  R   R  R$   R  R(   R3   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_cgi_escaping_fix  s    	"c         C   s5   |  i  d d d } |  i | i d  d  | _ d  S(   NR5   R   s	   text/html(   R   R   R   R   (   R
   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_content_type_none  s    c         C   sA   |  i  d d d } t d  | _ |  i | i i   d  d  S(   NR5   R   R$   R)   (   R   R    R(   R   RE   R3   (   R
   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_body_file_seekable  s    c         C   s  |  i  d  } |  i | i d d  |  i | i d d  |  i | i d d  |  i | i d d	  |  i | i d
 d  |  i | i d d  |  i | i d d  |  i | i d d  |  i t | i d d  o t | i d d   |  i t | i d d  p t | i d d   |  i | i d t  |  i | i d t  |  i | i d t  |  i | i d d  |  i | i d d3  |  i t | i d    |  i | i d  d! | _ d" | _ |  i t | i d    |  i | i d"  |  i | i d!  |  i | i	 d  |  i | i
 d  d# | _
 |  i | i d  |  i | i d  |  i | i d  j  |  i | i d  j  |  i | i d  |  i | i d$  |  i | i d%  |  i | i d&  |  i | i d'  |  i | i d(  |  i | i d)  |  i | i d  |  i | i d*  d+  |  i | i   d,  |  i | i   d,  |  i | i
 d(  |  i | i d  d- | i d. <|  i t | i i    d4 d5 d6 g  |  i | i d2 d-  d  S(7   Ns   /article?id=1RQ  s   localhost:80R   s   /articleR   s   id=1R%   R   R  R0   R/  R%  R3  RR  R  s   HTTP/1.0s   wsgi.errorsR   t   flushs
   wsgi.inputt   nextt   __next__s   wsgi.multiprocesss   wsgi.multithreads   wsgi.run_onces   wsgi.url_schemeRP  s   wsgi.versioni   i    R3   R   R   s   /blogs   http://localhosts   http://localhost/blogs   http://localhost/blog/articles"   http://localhost/blog/article?id=1s   /blog/articles   /blog/article?id=1t   archives   http://localhost/blog/archivet   articles   application/x-www-urlencodeds   Content-Types   Content-LengthR  R  R   (   i   i    (   s   Content-LengthR  (   s   Content-Types   application/x-www-urlencoded(   s   Hosts   localhost:80(   R   R   R   R'   R  RD   R(   R)   R   R    R  R!  R   R)  R   R,  R  R_  Rg  Rk  Rr  Rm  Ro  R   Ru  R  Rz  R   Rs   R   (   R
   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_request_init  sj    			
c         C   s  d d k  l } d d k  l } d d k  l } d d k  l } |  i d  } | d d d g h   } |  i | i |  |  i | i d d	  |  i | i i d  d d	 g  |  i t	 | i i
    d d d g  |  i t | i |   |  i t	 | i i
    g   d | _ d | _ |  i | i | d d g   |  i | i d
 d  |  i t | i |   |  i t	 | i i
    d d d d d g  |  i | i d
 d  |  i | i i d
  d d g  d  S(   Ni(   R   (   t   NestedMultiDict(   R   (   t   GetDicts   /test?check=a&check=b&name=Bobt   checkRW   RX   R   t   BobR$   s   name=Joe&email=joe@example.comt   Joet   emails   joe@example.com(   s   checkRW   (   s   checkRX   (   s   nameRa  (   s   checkRW   (   s   checkRX   (   s   nameRa  (   s   nameRb  (   s   emails   joe@example.com(   s   checkRW   (   s   checkRX   (   s   nameRa  (   s   nameRb  (   s   emails   joe@example.com(   R   R   R^  R   R_  R   R   R   t   getallR  R   R'   R   R$   R   R)   R  (   R
   R   R^  R   R_  R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt    test_request_query_and_POST_vars  s<    "		
c         C   s  d d k  l  } d d k l } d d k l } d d k l } d d k l } d d k l	 } d d k
 l } d d	 k
 l } |  i d
  }	 d |	 _ d |	 _ t t |	 i   |	 i d <d |	 i d <| d; d< d= g h   }
 |  i |	 i |
  |  i |	 i | d> d? d@ dA g   |  i t |	 i i    dB dC dD g  d |	 _ |  i t |	 i i    dE dF dG g  d |	 i d <|  i t |	 i t i   |  i t |	 i i    dH g  d  |	 _ |  i |	 i h d  d 6 |  i d! |	 i  j  d" |	 _  |  i t |	 i  |   |  i d! |	 i  j  |  i! t" |	 i  i# d! g  |  i |	 i  i$ d! d# g  d#  d$ |	 _% |  i |	 i% i$ d% g  d%  d& } |  i | |	 i& j  | |	 _& |  i t |	 i& |   |  i | |	 i& j  d' | } | |	 _& |	 i d( | j p t'  |  i | |	 i& j  | d) d* d* d+ d, d- | |	 _( |  i |	 i d. d/  | d0 d* d* d+ d, d- | } |  i |	 i(  |  i |	 i( | j  |  i |	 i)  |  i | d1 d2 d3 | d0 d* d* d+ d,   |	 i) j  d4 |	 _) |  i | d1 d5  |	 i) j  |  i | d1 d4  |	 i) j  | d1 d4  } |  i | |	 i) j  d6 |	 _* |  i t |	 i* |   |  i t+ |	 i*  dI  |	 i* i, d8 d9  } |  i t+ |  dJ  |  i | |	 i- j  | |	 _- |  i | |	 i- j  d: |	 _- |  i | |	 i- j  d  S(K   Ni(   R   (   t   Response(   R   (   t
   MIMEAccept(   t   Range(   t   ETagMatcher(   R   (   R_  s   /test?check=a&check=b&name=BobR   s#   var1=value1&var2=value2&rep=1&rep=2R#   s!   application/x-www-form-urlencodedR   R`  RW   RX   R   Ra  R   R   t   var2t   value2t   repRh   Ro   t   utf8s
   test=valueR  R   R  s	   text/htmls*   text/html;q=0.5, application/xhtml+xml;q=1s   application/xhtml+xmls	   es, pt-BRt   ess   opaque-tokens   W/"%s"s   if-none-matchi  i   i   i    R   s   If-Modified-Sinces   Sun, 01 Jan 2006 12:00:00 GMTi  t   etags	   some-etagt   last_modifieds   opaque-etags
   other-etags   bytes=0-100ie   t   lengthi  s   other-token(   s   checkRW   (   s   checkRX   (   s   names   Bob(   s   var1s   value1(   Rj  Rk  (   s   repRh   (   s   repRo   (   s   checkRW   (   s   checkRX   (   s   names   Bob(   s   checkRW   (   s   checkRX   (   s   names   Bob(   s   tests   value(   i    ie   (   i    ie   i  (.   R   t   webobRf  R   t   webob.acceptparseRg  t   webob.byterangeRh  t
   webob.etagRi  R   R   R_  R   R   R)   R   R&   R   R   R   R$   R  R   R   R   R'   R   Rf   t   collectionst   MutableMappingR   R  R   R   t   first_matchR  t   accept_languageR   R2   R   R   R   t   tuplet   content_ranget   if_match(   R
   R   Rf  R   Rg  Rh  Ri  R   R_  R   R   t   server_tokent
   weak_tokent   server_modifiedR  t   cr(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_request_put;  s    			"						
	!				c      
   C   s   d d k  l } d d k  l } |  i d  } d | _ d | _ t t | i   | i d <d | i d	 <| d d d g h   } |  i	 | i
 |  |  i	 | i | d d d d g   d  S(   Ni(   R   (   R_  s   /test?check=a&check=b&name=BobR   s#   var1=value1&var2=value2&rep=1&rep=2R#   s!   application/x-www-form-urlencodedR   R`  RW   RX   R   Ra  R   R   Rj  Rk  Rl  Rh   Ro   (   s   checkRW   (   s   checkRX   (   s   names   Bob(   s   var1s   value1(   s   var2s   value2(   s   repRh   (   s   repRo   (   R   R   R_  R   R   R)   R   R&   R   R   R   R$   (   R
   R   R_  R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_request_patch  s     		c         C   s   |  i  d  } d   } |  i | i |  d d
 g d g f  | i |  } d d k l } |  i t | |   |  i | i d  d d	 k	 l
 } |  i t | i |   |  i t | i i    d g  |  i | i d  d  S(   NR5   c         S   s   | d d g  d g S(   Ns   200 OKs   Content-types
   text/plains   Hi!(   s   Content-types
   text/plain(    (   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   wsgi_app  s    s   200 OKs   Content-types
   text/plains   Hi!i(   Rf  (   t   ResponseHeaders(   s   Content-types
   text/plain(   s   Content-types
   text/plain(   R   R   R   RO  t   webob.responseRf  R'   R   R   t   webob.headersR  R   R  R   R)   (   R
   R   R  R  Rf  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_call_WSGI_app  s    		
c         C   s   |  i  d  } d   } | i | d t } d d k l } |  i t | |   |  i | i d  d d k	 l
 } |  i t | i |   |  i t | i i    d g  |  i | i d
  d  S(   NR5   c         S   s   | d d g  d g S(   Ns   200 OKs   Content-types
   text/plains   Hi!(   s   Content-types
   text/plain(    (   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    t   catch_exc_infoi(   Rf  s   200 OK(   R  s   Content-types
   text/plains   Hi!(   s   Content-types
   text/plain(   R   RO  R,   R  Rf  R'   R   R   R   R  R  R   R  R   R)   (   R
   R   R  R  Rf  R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt%   test_get_response_catch_exc_info_true  s    	
c   	      C   s   |  i    } | i |  } |  i | i | i  t | i  } t | i  } |  i t | i d d   t | i d d    d | j o | d =n d | j o | d =n |  i | |  | i } | i } |  i | |  d  S(   Ns   Content-LengthR   (	   R   R8  R   Rr  t   dictR   t   intR  R)   (	   R
   R   R	  R   R  t   headers1t   headers2t   req_bodyt	   req2_body(    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s    		(;   R   R   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R
  R  R  R  R  R  R  R  R$  R&  R'  R+  R,  R-  R6  R7  R;  RA  RC  RD  RK  RR  RT  RU  RV  RW  R]  Re  R  R  R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  <	  sr   															*																											
	&		 	$	!									C	&	f			t   FakeCGIBodyTestsc           B   sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C   s  d d k  l } d d k l } l } d d k l } d } d d k l } d } | |  } | i	 d  i
 }	 |	 i d	 |  |	 i d
 d  |	 i d t |   | | d |	 }
 | i |
  } |  i | d i |  | | |  } |  i | i   |  d  S(   Ni(   R  (   R  t   FakeCGIBody(   R   s$   multipart/form-data; boundary=foobar(   R    s   --foobar
Content-Disposition: form-data; name="bananas"; filename="bananas.txt"
Content-type: text/plain; charset="utf-7"

these are the contents of the file 'bananas.txt'

--foobar--R5   R   R%   R$   R#   R   t   bananas(   R  R  R	   R  R  R   R   R9  R    R   R   R   R&   t   from_fieldstorageR   R  R3   (   R
   R  R  R  R   t   multipart_typeR    R)   t   multipart_bodyR   t   fst   varst	   fake_body(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt(   test_encode_multipart_value_type_options  s     c         C   s*   d d k  l } |  i t | h  d  d  S(   Ni(   R  s   multipart/form-data(   R	   R  R   R   (   R
   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt!   test_encode_multipart_no_boundary  s    c         C   sh   d d k  l } | h d d 6d  } | i d  d d  k } |  i | i d d t |   d  d  S(	   Ni(   R  R  s$   multipart/form-data; boundary=foobari   s   \b0x[0-9a-f]+\bs   <whereitsat>s=   <FakeCGIBody at <whereitsat> viewing {'bananas': 'ba...nas'}>(   R	   R  R3   R  R   t   subR  (   R
   R  R)   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   test_repr  s    	c         C   s@   d d k  l } | h d d 6d  } |  i | i   d   d  S(   Ni(   R  R  s$   multipart/form-data; boundary=foobar(   R	   R  R   t   filenoR   (   R
   R  R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_fileno  s    	c         C   sO   d d k  l } | h d d 6d  } |  i t |  d d d d d	 g  d  S(
   Ni(   R  R  s$   multipart/form-data; boundary=foobars
   --foobar
s0   Content-Disposition: form-data; name="bananas"
s   
s	   bananas
s
   --foobar--(   R	   R  R   R  (   R
   R  R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   test_iter  s    	c         C   s   d d k  l } | h d d 6d  } |  i | i   d  |  i | i   d  |  i | i   d  |  i | i   d  |  i | i   d	  d  S(
   Ni(   R  R  s$   multipart/form-data; boundary=foobars
   --foobar
s0   Content-Disposition: form-data; name="bananas"
s   
s	   bananas
s
   --foobar--(   R	   R  R   t   readline(   R
   R  R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_readline"  s    		c         C   s=   d d k  l } | h d d 6d  } |  i t | i  d  S(   Ni(   R  R  s   application/jibberjabber(   R	   R  R   R2   R3   (   R
   R  R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_read_bad_content_type/  s    c         C   s@   d d k  l } | h d d 6d  } |  i | i   d  d  S(   Ni(   R  R  s!   application/x-www-form-urlencodeds   bananas=bananas(   R	   R  R   R3   (   R
   R  R)   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_read_urlencoded4  s    	(
   R   R   R  R  R  R  R  R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s   							t"   Test_cgi_FieldStorage__repr__patchc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   d d k  l } | |  S(   Ni(   t   _cgi_FieldStorage__repr__patch(   R	   R  (   R
   t   fakeR  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   _callFUT<  s    c         C   sB   d t  f d     Y} |   } |  i |  } |  i | d  d  S(   Nt   Fakec           B   s    e  Z d  Z d Z d Z d Z RS(   R   R   R   R  (   R   R   R   R   R   R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  A  s   s    FieldStorage('name', 'filename')(   R   R  R   (   R
   R  R  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_with_file@  s    	c         C   sB   d t  f d     Y} |   } |  i |  } |  i | d  d  S(   NR  c           B   s    e  Z d  Z d Z d Z d Z RS(   R   R   R  N(   R   R   R   R   R   R   R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  K  s   s)   FieldStorage('name', 'filename', 'value')(   R   R  R   (   R
   R  R  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_without_fileJ  s    	(   R   R   R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  ;  s   		
t   TestLimitedLengthFilec           B   s   e  Z d    Z d   Z RS(   c         C   s   d d k  l } | | |  S(   Ni(   t   LimitedLengthFile(   R	   R  (   R
   R   t   maxlenR  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR   V  s    c         C   sK   d t  f d     Y} |   } |  i | d  } |  i | i   d  d  S(   Nt	   DummyFilec           B   s   e  Z d    Z RS(   c         S   s   d S(   Ni   (    (   R
   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  \  s    (   R   R   R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  [  s   i    i   (   R   R   R   R  (   R
   R  t	   dummyfileRh  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  Z  s    	(   R   R   R   R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  U  s   	t   Test_environ_from_urlc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         O   s   d d k  l } | | |   S(   Ni(   t   environ_from_url(   R	   R  (   R
   R   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  d  s    c         C   sC  |  i  t |  i d  |  i  t |  i d  |  i d  } |  i | i d d   d  |  i | i d d   d  |  i | i d d   d	  |  i | i d
 d   d  |  i | i d d   d  |  i | i d d   d  |  i | i d d   d  |  i d  } |  i | i d d   d  |  i | i d d   d  |  i | i d d   d	  |  i | i d
 d   d  |  i | i d d   d  |  i | i d d   d  |  i | i d d   d  d d k l } | | d   |  i d | j  |  i d | j  | | h d d 6 |  i | i d d   d  |  i | i d d   d  |  i | i d d   d	  |  i | i d
 d   d  |  i | i d d   d  |  i | i d d   d  |  i | i d d   d  |  i | i d d   d  |  i | i d d   d  |  i | d i	   d  d  S(    Ns&   http://www.example.com/foo?bar=baz#quxs   gopher://gopher.example.coms"   http://www.example.com/foo?bar=bazRQ  s   www.example.com:80R   s   /fooR   s   bar=bazR%   R   R  R0   R/  s   www.example.comR3  RR  s#   https://www.example.com/foo?bar=bazs   www.example.com:443RY  i(   t   environ_add_POSTR   R#   R)  R*  R$   t   11s!   application/x-www-form-urlencodeds
   wsgi.inputs   hello=world(
   R   R   R  R   R  R   R	   R  R'   R3   (   R
   R   R  (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_environ_from_urlh  sH    c         C   sx   d d k  l } |  i d  } |  i | d d  | |  } t d d  } |  i | i |  |  i | i |  d  S(   Ni(   R   s
   /%E6%B5%81R   s   /流s   utf-8(   R	   R   R  R   R   R!  R:  (   R
   R   RL  R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt)   test_environ_from_url_highorder_path_info  s    c         C   s   d d k  l } d d  k } | i d d  | i d d t d d d
 d  } |  i d | i i d  j t	 |   |  i d | i i d  j t	 |   d  S(   Ni(   R   s   application/x-foos   .fooR5   R$   t   file1s   foo.foot   xxxt   file2s   bar.mp3s
   audio/mpegt   ascii(   s   foo.fooR  (   s   bar.mp3R  (
   R	   R   t	   mimetypest   add_typeR   R  R'   R)   R  R   (   R
   R   R  R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt#   test_fileupload_mime_type_detection  s    (   R   R   R  R  R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  c  s   		*		t   TestRequestMultipartc           B   s   e  Z d    Z RS(   c         C   sU   d d k  l } | i t  } |  i | i d i d  t d d  i d   d  S(   Ni(   R   t   titleRm  s   こんにちはs   utf-8(   R	   R   R
  t   _test_req_multipart_charsetR   R$   R   R   (   R
   R   R   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   test_multipart_with_charset  s    (   R   R   R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s   c         C   sS  d d k  l } d } d g } | | |  | |   } d | _ g  } d d | i d	 t | i i d
   d t | i  d | i i	 d d g  d | i
 d | i d | i d | i d | i d | i d d | i | i | i | i f d | i d | i f d | i d | i d | i d | i g D] } | t |  q9~ S(   Ni(   R   s   200 OKs   Content-types
   text/plaint   bobs   Hello world!
s   The get is %rs    and Val is %s
R   s   The languages are: %s
s   The accepttypes is: %s
s   application/xmls	   text/htmls   post is %r
s   params is %r
s   cookies is %r
s	   body: %r
s   method: %s
s   remote_user: %r
R(  s9   host_url: %r; application_url: %r; path_url: %r; url: %r
s   urlvars: %r
s   urlargs: %r
s   is_xhr: %r
s   if_modified_since: %r
s   user_agent: %r
s   if_none_match: %r
(   s   Content-types
   text/plain(   R	   R   R)  R   R  R  R  Ry  R  R  R$   R  Rf   R)   R   R   R_  Rg  Rk  Rr  RK   R\   R  R   t
   user_agentR   R   (   R   R   R   R   t   response_headersR   Rt   Ru   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s<    		










sH   --boundary
Content-Disposition: form-data; name="%20%22""


--boundary--c         C   s(   d i  |  i   i d d  i d   S(   Ns   
s   R0   s   
(   R   Rr   R  Rq   (   t   s(    (    s1   /home/chrism/projects/webob/tests/test_request.pyt	   _norm_req  s    s<  
POST /webob/ HTTP/1.0
Accept: */*
Cache-Control: max-age=0
Content-Type: multipart/form-data; boundary=----------------------------deb95b63e42a
Host: pythonpaste.org
User-Agent: UserAgent/1.0 (identifier-version) library/7.0 otherlibrary/0.8

------------------------------deb95b63e42a
Content-Disposition: form-data; name="foo"

foo
------------------------------deb95b63e42a
Content-Disposition: form-data; name="bar"; filename="bar.txt"
Content-type: application/octet-stream

these are the contents of the file 'bar.txt'

------------------------------deb95b63e42a--
s$   
POST / HTTP/1.0
Content-Length: 0

s=  
POST /upload/ HTTP/1.1
Host: foo.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.8,ja;q=0.6
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Content-Type: multipart/form-data; boundary=000e0ce0b196b4ee6804c6c8af94
Content-Length: 926

--000e0ce0b196b4ee6804c6c8af94
Content-Type: text/plain; charset=ISO-2022-JP
Content-Disposition: form-data; name=title
Content-Transfer-Encoding: 7bit

$B$3$s$K$A$O(B
--000e0ce0b196b4ee6804c6c8af94
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: form-data; name=submit

Submit
--000e0ce0b196b4ee6804c6c8af94
Content-Type: message/external-body; charset=ISO-8859-1; blob-key=AMIfv94TgpPBtKTL3a0U9Qh1QCX7OWSsmdkIoD2ws45kP9zQAGTOfGNz4U18j7CVXzODk85WtiL5gZUFklTGY3y4G0Jz3KTPtJBOFDvQHQew7YUymRIpgUXgENS_fSEmInAIQdpSc2E78MRBVEZY392uhph3r-In96t8Z58WIRc-Yikx1bnarWo
Content-Disposition: form-data; name=file; filename="photo.jpg"

Content-Type: image/jpeg
Content-Length: 38491
X-AppEngine-Upload-Creation: 2012-08-08 15:32:29.035959
Content-MD5: ZjRmNGRhYmNhZTkyNzcyOWQ5ZGUwNDgzOWFkNDAxN2Y=
Content-Disposition: form-data; name=file; filename="photo.jpg"


--000e0ce0b196b4ee6804c6c8af94--s   
R  c           B   s   e  Z d    Z d d  Z RS(   c         C   s   | |  _  d |  _ d  S(   Ni    (   RF   t   pos(   R
   RF   (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR0    s    	ic         C   s   | d j o' |  i  |  i } t |  i   |  _ | S|  i | t |  i   j p t  |  i  |  i |  i | !} |  i | 7_ | Sd  S(   Ni(   RF   R  R&   R2   (   R
   t   sizet   t(    (    s1   /home/chrism/projects/webob/tests/test_request.pyR3      s    $(   R   R   R0  R3   (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR    s   	R  c           B   s   e  Z d  d  Z RS(   i    c         C   s   t  d   d  S(   Ns   Invalid seek!(   R  (   R
   R  t   rel(    (    s1   /home/chrism/projects/webob/tests/test_request.pyRC   ,  s    (   R   R   RC   (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyR  +  s   ("   Rv  R   t   unittestR  R9  R    R   t   webob.compatR   R   R   R   R   t   TestCaseR   R  R  R  R  R  R  R  R  R  R  R  RE  R  R	  R>  R  R   R  R  (    (    (    s1   /home/chrism/projects/webob/tests/test_request.pyt   <module>   sJ   (           UE	%	#