ó
ç'ÊUc           @   s€   d  d l  m Z d  d l m Z d  d l m Z m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z d e f d „  ƒ  YZ d	 S(
   iÿÿÿÿ(   t   TestCase(   t   DepthMiddleware(   t   Responset   Request(   t   Spider(   t   StatsCollector(   t   get_crawlert   TestDepthMiddlewarec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s\   t  t ƒ } | j d ƒ |  _ t | ƒ |  _ |  j j |  j ƒ t d |  j t ƒ |  _	 d  S(   Ns   scrapytest.orgi   (
   R   R   t   _create_spidert   spiderR   t   statst   open_spiderR   t   Truet   mw(   t   selft   crawler(    (    sE   /home/travis/build/scrapy/scrapy/tests/test_spidermiddleware_depth.pyt   setUp   s
    c         C   sù   t  d ƒ } t d ƒ } | | _ t  d ƒ g } t |  j j | | |  j ƒ ƒ } |  j | | ƒ |  j j	 d d |  j ƒ} |  j | d ƒ d | j
 d <t |  j j | | |  j ƒ ƒ } |  j | g  ƒ |  j j	 d d |  j ƒ} |  j | d ƒ d  S(   Ns   http://scrapytest.orgs   request_depth_count/1R	   i   t   deptht   request_depth_max(   R   R   t   requestt   listR   t   process_spider_outputR	   t   assertEqualsR
   t	   get_valuet   meta(   R   t   reqt   respt   resultt   outt   rdct   out2t   rdm(    (    sE   /home/travis/build/scrapy/scrapy/tests/test_spidermiddleware_depth.pyt   test_process_spider_output   s    	!!c         C   s   |  j  j |  j d ƒ d  S(   Nt    (   R
   t   close_spiderR	   (   R   (    (    sE   /home/travis/build/scrapy/scrapy/tests/test_spidermiddleware_depth.pyt   tearDown)   s    (   t   __name__t
   __module__R   R    R#   (    (    (    sE   /home/travis/build/scrapy/scrapy/tests/test_spidermiddleware_depth.pyR   
   s   			N(   t   unittestR    t   scrapy.spidermiddlewares.depthR   t   scrapy.httpR   R   t   scrapy.spidersR   t   scrapy.statscollectorsR   t   scrapy.utils.testR   R   (    (    (    sE   /home/travis/build/scrapy/scrapy/tests/test_spidermiddleware_depth.pyt   <module>   s   