ó
`žTc           @   s   d  Z  d d l m Z m Z d d l m Z d d l m Z e e d   d e	 f d     YZ
 d e e
 f d	     YZ d
 S(   s  
    werkzeug.contrib.testtools
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    This module implements extended wrappers for simplified testing.

    `TestResponse`
        A response wrapper which adds various cached attributes for
        simplified assertions on various content types.

    :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
    :license: BSD, see LICENSE for more details.
i˙˙˙˙(   t   cached_propertyt   import_string(   t   Response(   t   warnsN   werkzeug.contrib.testtools is deprecated and will be removed with Werkzeug 1.0t   ContentAccessorsc           B   sM   e  Z d  Z d   Z e e  Z d   Z e e  Z d   Z e e  Z RS(   sl   
    A mixin class for response objects that provides a couple of useful
    accessors for unittesting.
    c         C   s}   d |  j  k r% t d |  j    n  xE d d d g D]4 } t | d t } | d k	 r5 | j |  j  Sq5 Wt d   d S(	   s   Get an etree if possible.t   xmls%   Not a XML response (Content-Type: %s)s   xml.etree.ElementTreet   ElementTrees   elementtree.ElementTreet   silents;   You must have ElementTree installed to use TestResponse.xmlN(   t   mimetypet   AttributeErrorR   t   Truet   Nonet   XMLt   bodyt   RuntimeError(   t   selft   modulet   etree(    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyR      s    	c         C   s   d |  j  k r- d |  j  k r- t d   n  d d l m } y d d l m } Wn t k
 rm | j } n X|  j  d k r | |  j  S| j	 |  j  S(   s   Get an lxml etree if possible.t   htmlR   s   Not an HTML/XML responsei˙˙˙˙(   R   (   t
   fromstrings	   text/html(
   R   R	   t   lxmlR   t	   lxml.htmlR   t   ImportErrort   HTMLt   dataR   (   R   R   R   (    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyR   ,   s    c         C   sc   d |  j  k r t d   n  y d d l m } Wn! t k
 rU d d l m } n X| |  j  S(   s/   Get the result of simplejson.loads if possible.t   jsons   Not a JSON responsei˙˙˙˙(   t   loads(   R   R	   t
   simplejsonR   R   R   R   (   R   R   (    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyR   :   s    (   t   __name__t
   __module__t   __doc__R   R    R   R   (    (    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyR      s   				t   TestResponsec           B   s   e  Z d  Z RS(   s;   Pass this to `werkzeug.test.Client` for easier unittesting.(   R   R   R   (    (    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyR   F   s   N(   R   t   werkzeug.utilsR    R   t   werkzeug.wrappersR   t   warningsR   t   DeprecationWarningt   objectR   R   (    (    (    s`   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/contrib/testtools.pyt   <module>   s   /