ó
O'—^c           @@  sß   d  d l  m Z d  d l Z d  d l m Z m Z m Z m Z m Z d  d l	 m
 Z
 d  d l m Z d d l m Z m Z m Z d d l m Z d	 „  Z d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   i    (   t   absolute_importN(   t
   Connectiont   Exchanget   Producert   Queuet   binding(   t   NotBoundError(   t   registryi   (   t   Caset   Mockt   call(   t	   Transportc           C@  s   t  d t ƒ S(   Nt	   transport(   R   R   (    (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   get_conn   s    t   test_bindingc           B@  s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c      	   C@  s“   t  t d ƒ d d i d d 6d i d d 6ƒ} |  j | j t d ƒ ƒ |  j | j d ƒ |  j | j i d d 6ƒ |  j | j i d d 6ƒ d  S(	   Nt   foot   rkeyt	   argumentst   bvalt   bargt   unbind_argumentst   uvalt   uarg(   R   R   t   assertEqualt   exchanget   routing_keyt   assertDictEqualR   R   (   t   selft   x(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_constructor   s    c         C@  sE   t  ƒ  j ƒ  } t t d ƒ d ƒ } | j | ƒ |  j d | ƒ d  S(   NR   R   t   exchange_declare(   R   t   channelR   R   t   declaret   assertIn(   R   t   chanR   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_declare   s    c         C@  s9   t  ƒ  j ƒ  } t ƒ  } | j | ƒ |  j d | ƒ d  S(   NR   (   R   R   R   R    t   assertNotIn(   R   R"   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_declare_no_exchange$   s    	c         C@  sN   t  ƒ  j ƒ  } t t d ƒ ƒ } | j t d ƒ | ƒ ƒ |  j d | ƒ d  S(   NR   t   bart   exchange_bind(   R   R   R   R   t   bindR!   (   R   R"   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt	   test_bind*   s    c         C@  sN   t  ƒ  j ƒ  } t t d ƒ ƒ } | j t d ƒ | ƒ ƒ |  j d | ƒ d  S(   NR   R&   t   exchange_unbind(   R   R   R   R   t   unbindR!   (   R   R"   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_unbind0   s    c         C@  sE   t  t d ƒ d ƒ } |  j d t | ƒ ƒ |  j d t | ƒ ƒ d  S(   NR   R   (   R   R   R!   t   repr(   R   t   b(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt	   test_repr6   s    (   t   __name__t
   __module__R   R#   R%   R)   R,   R/   (    (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyR      s   					t   test_Exchangec           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 RS(   c         C@  sš   t  d d ƒ } |  j | j ƒ |  j d t | ƒ ƒ t ƒ  j ƒ  } | j | ƒ } |  j | j ƒ |  j	 | j | ƒ |  j d | j
 f t | ƒ ƒ d  S(   NR   t   directs   <unbounds   bound to chan:%r(   R   t   assertFalset   is_boundR!   R-   R   R   R(   t
   assertTruet   assertIst
   channel_id(   R   R   R"   t   bound(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt
   test_bound>   s    c         C@  sT   |  j  t t d ƒ ƒ t t d ƒ ƒ ƒ |  j t t d ƒ ƒ t t d ƒ ƒ ƒ d  S(   Nt   aR.   (   R   t   hashR   t   assertNotEqual(   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt	   test_hashJ   s    (c         C@  s<   |  j  t d d t ƒj ƒ |  j  t d d t ƒj ƒ d  S(   NR;   t   durable(   R6   R   t   Truet   can_cache_declarationt   False(   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_can_cache_declarationN   s    c         C@  s;   t  d d ƒ } t j t j | ƒ ƒ } |  j | | ƒ d  S(   NR   R3   (   R   t   picklet   loadst   dumpsR   (   R   t   e1t   e2(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_pickleR   s    c         C@  sj   t  d d ƒ } t  d d ƒ } |  j | | ƒ t  d d ƒ } |  j | | ƒ |  j | j t ƒ t ƒ d  S(   NR   R3   t   topic(   R   R   R=   t   __eq__R@   t   NotImplemented(   R   RG   RH   t   e3(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_eqW   s    c         C@  sÃ   t  d d ƒ } t ƒ  } | j ƒ  } | j | ƒ |  j | j ƒ |  j | j ƒ | j | ƒ } |  j	 | j ƒ |  j
 | j | ƒ | j ƒ  } | j | ƒ |  j	 | j ƒ |  j
 | j | ƒ d  S(   NR   R3   (   R   R   R   t   reviveR4   R5   t   assertIsNonet   _channelR(   R6   R7   (   R   R   t   connR"   R9   t   chan2(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_revivea   s    	c         C@  sk   t  d d ƒ } |  j t ƒ  | j ƒ  Wd  QXt ƒ  } | j ƒ  } | j | ƒ j ƒ  |  j d | ƒ d  S(   NR   R3   R   (   R   t   assertRaisesR   R    R   R   R(   R!   (   R   R   RR   R"   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_assert_is_boundt   s    	c         C@  s/   t  d d d d ƒ} |  j | j t  j ƒ d  S(   NR   R3   t   delivery_modet	   transient(   R   R   RW   t   TRANSIENT_DELIVERY_MODE(   R   t   exc(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt    test_set_transient_delivery_mode~   s    c         C@  s)   t  d d d t ƒ} |  j | j ƒ d  S(   NR   R3   t   passive(   R   R@   R6   R\   (   R   RZ   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_set_passive_mode‚   s    c         C@  s/   t  d d d d ƒ} |  j | j t  j ƒ d  S(   NR   R3   RW   t
   persistent(   R   R   RW   t   PERSISTENT_DELIVERY_MODE(   R   RZ   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt!   test_set_persistent_delivery_mode†   s    c         C@  s)   |  j  t d d t ƒ  j ƒ  ƒj ƒ d  S(   NR   R   (   R6   R   R   R   R5   (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_bind_at_instantiationŠ   s    c         C@  sC   t  ƒ  j ƒ  } t d d | ƒj i d d 6ƒ |  j d | ƒ d  S(   NR   R   R&   t   prepare_message(   R   R   R   t   MessageR!   (   R   R"   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_create_message   s     c         C@  s<   t  ƒ  j ƒ  } t d d | ƒj d ƒ |  j d | ƒ d  S(   NR   R   s   the quick brown foxt   basic_publish(   R   R   R   t   publishR!   (   R   R"   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_publish’   s    c         C@  s9   t  ƒ  j ƒ  } t d d | ƒj ƒ  |  j d | ƒ d  S(   NR   R   t   exchange_delete(   R   R   R   t   deleteR!   (   R   R"   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_delete—   s    c         C@  s?   t  d d ƒ } |  j d t | ƒ ƒ |  j d t | ƒ ƒ d  S(   NR   RJ   s
   foo(topic)R   (   R   R!   R-   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test__repr__œ   s    c         C@  sT   t  ƒ  j ƒ  } t d d ƒ } t d d ƒ } | | ƒ j | ƒ |  j d | ƒ d  S(   NR   RJ   R&   R'   (   R   R   R   t   bind_toR!   (   R   R"   R   R&   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_bind_to¡   s
    c         C@  sE   t  ƒ  j ƒ  } t d d ƒ } | | ƒ j d ƒ |  j d | ƒ d  S(   NR   RJ   R&   R'   (   R   R   R   Rl   R!   (   R   R"   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_bind_to_by_name¨   s    c         C@  sT   t  ƒ  j ƒ  } t d d ƒ } t d d ƒ } | | ƒ j | ƒ |  j d | ƒ d  S(   NR   RJ   R&   R*   (   R   R   R   t   unbind_fromR!   (   R   R"   R   R&   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_unbind_from®   s
    c         C@  sE   t  ƒ  j ƒ  } t d d ƒ } | | ƒ j d ƒ |  j d | ƒ d  S(   NR   RJ   R&   R*   (   R   R   R   Ro   R!   (   R   R"   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_unbind_from_by_nameµ   s    (   R0   R1   R:   R>   RC   RI   RN   RT   RV   R[   R]   R`   Ra   Rd   Rg   Rj   Rk   Rm   Rn   Rp   Rq   (    (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyR2   <   s&   					
		
											t
   test_Queuec           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 RS(   c         C@  s   t  d d ƒ |  _ d  S(   NR   R3   (   R   R   (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   setUp¾   s    c         C@  sT   |  j  t t d ƒ ƒ t t d ƒ ƒ ƒ |  j t t d ƒ ƒ t t d ƒ ƒ ƒ d  S(   NR;   R.   (   R   R<   R   R=   (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyR>   Á   s    (c         C@  sM   t  d ƒ } t d d | j d ƒ | j d ƒ g ƒ} |  j t | ƒ ƒ d  S(   NR   t   bindingst   At   B(   R   R   R   R6   R-   (   R   t   exR   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_repr_with_bindingsÅ   s    *c         C@  sc   t  ƒ  } t d t t d ƒ d ƒ g ƒ } d | j _ | | ƒ } | j ƒ  |  j | j d ƒ d  S(   NRt   R   R   t	   generatedi    (   Ry   i    i    (	   R	   R   R   R   t   queue_declaret   return_valueR    R   t   name(   R   R"   R   t   xx(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_anonymousÊ   s    	!
c         C@  s¨   t  d ƒ } t d d |  j ƒ} t | ƒ } | j i t ƒ  d 6d | g d |  j d d ƒ| | ƒ j d t ƒ } |  j | ƒ |  j	 | j
 ƒ  | j ƒ  Wd  QXd  S(	   Ns	   memory://R   R   t   complexR    t
   serializerRD   t   no_ack(   R   R   R   R   Rf   t   objectt   getR@   t   assertIsNotNoneRU   t   ContentDisallowedt   decode(   R   RR   t   qt   pt   message(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt!   test_basic_get__accept_disallowedÒ   s    c         C@  s«   t  d ƒ } t d d |  j ƒ} t | ƒ } | j i t ƒ  d 6d | g d |  j d d ƒ| | ƒ j d d g d	 t ƒ } |  j | ƒ | j	 ƒ  } |  j
 | d ƒ d  S(
   Ns	   memory://R   R   R   R    R€   RD   t   acceptR   (   R   R   R   R   Rf   R‚   Rƒ   R@   R„   R†   R6   (   R   RR   R‡   Rˆ   R‰   t   payload(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_basic_get__accept_allowedá   s    !c         C@  s,   t  d ƒ } d  | _ |  j | j ƒ  ƒ d  S(   NR;   (   R   t   NoneR   RP   t
   when_bound(   R   R‡   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_when_bound_but_no_exchangeð   s    	c         C@  sQ   t  d ƒ } t ƒ  | _ t ƒ  | _ d  | _ | j ƒ  | j j t d t ƒd  S(   NR;   R\   (	   R   R	   Rz   t
   queue_bindRŽ   R   R    t   assert_called_withRB   (   R   R‡   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_declare_but_no_exchangeõ   s    	
c         C@  s?   t  ƒ  } t d ƒ } | | ƒ j d ƒ |  j | j j ƒ d  S(   NR;   Rw   (   R	   R   Rl   R6   R‘   t   called(   R   R"   R‡   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_bind_to_when_nameþ   s    	c         C@  s;   t  ƒ  } t d ƒ | ƒ } d  | _ |  j | j ƒ  ƒ d  S(   NR;   (   R	   R   RŽ   t   message_to_pythonR6   Rƒ   (   R   R"   R‡   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_get_when_no_m2p  s    		c         C@  s¥   t  ƒ  } t d t t d ƒ d ƒ t t d ƒ d ƒ t t d ƒ d ƒ g ƒ } | | ƒ j ƒ  |  j t d t d	 d d
 t d t d d  d d d t	 ƒ | j
 j ƒ d  S(   Nt   mult   mul1t   rkey1t   mul2t   rkey2t   mul3t   rkey3t   nowaitR   t   auto_deleteR\   R   t   typeR3   R?   (   R	   R   R   R   R    R!   R
   RB   RŽ   R@   R   t   call_args_list(   R   R"   R‡   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_multiple_bindings
  s     	c         C@  s<   |  j  t d d t ƒj ƒ |  j  t d d t ƒj ƒ d  S(   NR;   R?   (   R6   R   R@   RA   RB   (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyRC     s    c         C@  sŽ   t  d t d d ƒ d ƒ } t  d t d d ƒ d ƒ } |  j | | ƒ |  j | j t ƒ t ƒ t  d t d d ƒ d ƒ } |  j | | ƒ d  S(   Nt   xxxR3   t   yyy(   R   R   R   RK   R@   RL   R=   (   R   t   q1t   q2t   q3(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyRN   #  s    c         C@  s&   |  j  t d |  j d t ƒj ƒ d  S(   NR   t	   exclusive(   R6   R   R   R@   R    (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt"   test_exclusive_implies_auto_delete,  s    c         C@  s/   |  j  t d |  j d t ƒ  j ƒ  ƒj ƒ d  S(   NR   R   (   R6   R   R   R   R   R5   (   R   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_binds_at_instantiation1  s    c         C@  s©   t  ƒ  j ƒ  } t d |  j ƒ } |  j | j ƒ |  j | j j ƒ | j | ƒ } |  j | j ƒ |  j | j j ƒ |  j | j | j j ƒ |  j	 | j |  j ƒ d  S(   NR   (
   R   R   R   R   R4   R5   R(   R6   R7   t   assertIsNot(   R   R"   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_also_binds_exchange5  s    c         C@  sx   t  ƒ  j ƒ  } t d |  j d d | ƒ} |  j | j ƒ | j ƒ  |  j d | ƒ |  j d | ƒ |  j d | ƒ d  S(   NR   R   R   Rz   R‘   (   R   R   R   R   R6   R5   R    R!   (   R   R"   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyR#   @  s    
c         C@  sE   t  d |  j d d t ƒ  j ƒ  ƒ} | j ƒ  |  j d | j ƒ d  S(   NR   R   t	   basic_get(   R   R   R   R   Rƒ   R!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_getI  s    $
c         C@  sE   t  d |  j d d t ƒ  j ƒ  ƒ} | j ƒ  |  j d | j ƒ d  S(   NR   R   t   queue_purge(   R   R   R   R   t   purgeR!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt
   test_purgeN  s    $
c         C@  sK   t  d |  j d d t ƒ  j ƒ  ƒ} | j d d  ƒ |  j d | j ƒ d  S(   NR   R   t   fifafot   basic_consume(   R   R   R   R   t   consumeRŽ   R!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_consumeS  s    $c         C@  sH   t  d |  j d d t ƒ  j ƒ  ƒ} | j d ƒ |  j d | j ƒ d  S(   NR   R   R³   t   basic_cancel(   R   R   R   R   t   cancelR!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_cancelX  s    $c         C@  sE   t  d |  j d d t ƒ  j ƒ  ƒ} | j ƒ  |  j d | j ƒ d  S(   NR   R   t   queue_delete(   R   R   R   R   Ri   R!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyRj   ]  s    $
c         C@  sE   t  d |  j d d t ƒ  j ƒ  ƒ} | j ƒ  |  j d | j ƒ d  S(   NR   R   t   queue_unbind(   R   R   R   R   R»   R!   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_queue_unbindb  s    $
c         C@  sI   t  d |  j d ƒ } | j d t ƒ } |  j | d d |  j j ƒ d  S(   NR   t   rkt   recurseR   R|   (   R   R   t   as_dictR@   R   R|   (   R   R‡   t   d(    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_as_dictg  s    c         C@  so   t  |  j d ƒ } t d |  j d d | g ƒ} | j d t ƒ } |  j | d d d d ƒ t j | ƒ d  S(   NR½   R   Rt   R¾   i    R   (   R   R   R   R¿   R@   R   R   RF   (   R   R.   R‡   RÀ   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   test_queue_dumpl  s
    c         C@  sE   t  d |  j d ƒ } |  j d t | ƒ ƒ |  j d t | ƒ ƒ d  S(   NR   R   (   R   R   R!   R-   (   R   R.   (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyRk   s  s    (   R0   R1   Rs   R>   Rx   R~   RŠ   R   R   R“   R•   R—   R£   RC   RN   Rª   R«   R­   R#   R¯   R²   R¶   R¹   Rj   R¼   RÁ   RÂ   Rk   (    (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyRr   ¼   s4   																												(   t
   __future__R    RD   t   kombuR   R   R   R   R   t   kombu.exceptionsR   t   kombu.serializationR   t   caseR   R	   R
   t   mocksR   R   R   R2   Rr   (    (    (    s;   /tmp/pip-unpacked-wheel-UAnTfW/kombu/tests/test_entities.pyt   <module>   s   (	+€