σ
P'^c           @@  sη   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l m Z d   Z d	   Z d
   Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   i    (   t   absolute_import(   t   Exchange(   t   maybe_evaluate(   t   routes(   t   QueueNotFound(   t   LRUCache(   t   AppCasec         O@  s   t  j d |  | |  S(   Nt   app(   R   t   Router(   R   t   argst   kwargs(    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyR      s    c         @  s      f d   } | S(   Nc         @  s   t    g    j |   S(   N(   R   t   expand_destination(   t   answer(   R   t   queues(    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   expand   s    (    (   R   R   R   (    (   R   R   s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   E   s    c         K@  s(   | |  j  _ |  j j |  |  j _ d  S(   N(   t   conft   CELERY_QUEUESt   amqpt   QueuesR   (   R   R   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt
   set_queues   s    t	   RouteCasec           B@  s   e  Z d    Z RS(   c         C@  s    i d d 6d d 6d d 6|  _  i d d 6d d 6d	 d 6|  _ i |  j j j d 6|  j j j d 6|  j j j d 6|  _ |  j j d
 t	  d    } | |  _
 d  S(   Nt   fooexchanget   exchanget   fanoutt   exchange_typet   xuzzyt   routing_keyt   barexchanget   topics   b.b.#t   sharedc           S@  s   d  S(   N(    (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   mytask/   s    (   t   a_queuet   b_queueR   R   t   CELERY_DEFAULT_EXCHANGEt   CELERY_DEFAULT_EXCHANGE_TYPEt   CELERY_DEFAULT_ROUTING_KEYt   d_queuet   taskt   FalseR   (   t   selfR   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   setup   s    (   t   __name__t
   __module__R)   (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyR      s   t   test_MapRoutec           B@  s#   e  Z d    Z d   Z d   Z RS(   c         C@  s£   t  |  j d |  j d |  j t |  j |  j j j  } t j i i d d 6|  j	 j
 6 } |  j | | j |  j	 j
   d j
 d  |  j | j d   d  S(   Nt   foot   bart   queues   celery.awesome(   R   R   R    R!   R   R   R   R   t   MapRouteR   t   namet   assertEqualt   route_for_taskt   assertIsNone(   R(   R   t   route(    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt"   test_route_for_task_expanded_route7   s    #c         C@  s   t  |  j d |  j d |  j t |  j |  j j j  } t j i |  j |  j	 j
 6 } |  j |  j | | j |  j	 j
    |  j | j d   d  S(   NR-   R.   s   celery.awesome(   R   R   R    R!   R   R   R   R   R0   R   R1   t   assertDictContainsSubsetR3   R4   (   R(   R   R5   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_route_for_taskA   s    c         C@  sw   t  |  j |  j j j |  j j j t   } t j i i d d 6d 6 } |  j	 t
   | | j d   Wd  QXd  S(   Nt   xR/   t   a(   R   R   R   R   R   R   R'   R   R0   t   assertRaisesR   R3   (   R(   R   R5   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_expand_route_not_foundK   s
    (   R*   R+   R6   R8   R<   (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyR,   5   s   	
	
t   test_lookup_routec           B@  s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C@  s,   t  |  j d d  } |  j | j i   d  S(   NR   (   R   R   t   Nonet   assertDictEqualR   (   R(   t   router(    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_init_queuesU   s    c         C@  sΉ   t  |  j d |  j d |  j t j i i d d 6|  j j 6i i d d 6|  j j 6f  } t |  j | |  j j	 j
  } |  j | j i  |  j j d d d g d i  d j d  d  S(   NR-   R.   R/   R	   i   i   R
   (   R   R   R    R!   R   t   prepareR   R1   R   R   R   R2   R5   (   R(   t   RR@   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_lookup_takes_firstY   s     c         C@  sι   t  |  j  t j d  } t |  j | |  j j j d t } | j i d d 6d  d 6d  d 6t
 d 6|  j j d d d	 g d
 i  } |  j | d j d  |  j | d j t d   |  j | d j d  |  j | d t
  d  S(   Nt   create_missingt   testqR/   R   R   t	   immediateR	   i   i   R
   (    (   R   R   R   RB   R   R   R   t   TrueR5   R>   R'   R   R1   R2   R   R   R   (   R(   RC   R@   R5   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_expands_queue_in_optionsa   s    !
c         C@  sg   t  |  j d |  j d |  j t |  j i  |  j j j  } | j d  } |  j | d j	 d  d  S(   NR-   R.   R/   (
   R   R   R    R!   R   R   R   R   R2   R1   (   R(   R9   t   dest(    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_expand_destination_stringv   s    c      	   C@  sυ   t  |  j d |  j d |  j i |  j |  j j j 6t j i i d d 6d 6i i d d 6|  j	 j
 6f  } t |  j | |  j j j  } |  j | j i  |  j	 j
 d d d g d i  d j
 d  |  j | j i  d	  d j
 |  j j j  d  S(
   NR-   R.   R/   s   celery.xazaR	   i   i   R
   s   celery.poza(   R   R   R    R!   R%   R   t   CELERY_DEFAULT_QUEUER   RB   R   R1   R   R   R   R2   R5   (   R(   RC   R@   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_lookup_paths_traversed|   s      (   R*   R+   RA   RD   RI   RK   RM   (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyR=   S   s
   				t   test_preparec           B@  s   e  Z d    Z d   Z RS(   c         C@  s   t    } i d d 6d | g } t j |  } |  j | d t j  |  j t | d  t  |  j | d |  |  j t j |  | g  d  S(   NR.   R-   s    celery.utils.functional.LRUCachei    i   i   (	   t   objectR   RB   t   assertIsInstanceR0   R   R   t   assertIsR2   (   R(   t   oRC   t   p(    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyRN      s    	
c         C@  s7   i d d 6} t  j |  } |  j | d t  j  d  S(   NR.   R-   i    (   R   RB   RP   R0   (   R(   RC   RS   (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   test_prepare_item_is_dict   s    (   R*   R+   RN   RT   (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyRN      s   	N(   t
   __future__R    t   kombuR   t   kombu.utils.functionalR   t
   celery.appR   t   celery.exceptionsR   t   celery.utils.functionalR   t   celery.tests.caseR   R   R   R   R   R,   R=   RN   (    (    (    s>   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/app/test_routes.pyt   <module>   s   			;