ó
6j/Qc           @   s   d  Z  d d l Z d e j f d     YZ d e j f d     YZ d e j f d     YZ d	 e j f d
     YZ d e j f d     YZ d   Z d S(   s   Pure-Python hookable tests
i˙˙˙˙Nt   PermissionProxyTestsc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   d d l  m } | S(   Ni˙˙˙˙(   t   PermissionProxy(   t   zope.component.securityR   (   t   selfR   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   _getTargetClass   s    c         C   s   |  j    |  S(   N(   R   (   R   t   wrapped(    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   _makeOne   s    c         C   s    d d l  m } d d l  m } d d l  m } d | f d     Y} | |  d t f d     Y } |   } |  j |  } |  j | |  | |   d  S(	   Ni˙˙˙˙(   t	   Interface(   t   implementer(   t
   providedByt   IFooc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
       s   t   Fooc           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR   "   s   (   t   zope.interfaceR   R   R	   t   objectR   t   assertEqual(   R   R   R   R	   R
   R   t   foot   proxy(    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt$   test_proxy_delegates___provided_by__   s    	(   R   R   R   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR       s   		t   Test__checkerc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         O   s   d d l  m } | | |   S(   Ni˙˙˙˙(   t   _checker(   R   R   (   R   t   argst   kwR   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   _callFUT,   s    c         C   sY   d d l  m } |  j t   d d d  } |  j | j i | d 6 |  j | j  d  S(   Ni˙˙˙˙(   t   CheckerPublics   zope.Publict   __call__(    (    (   t   zope.security.checkerR   R   R   R   t   get_permissionst   assertFalset   set_permissions(   R   R   t   checker(    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt0   test_no_allowed_attributes_no_allowed_interfaces0   s    c         C   s   d d l  m } d | f d     Y} d | f d     Y} |  j t   d | | f d  } |  j | j i d d 6d d	 6d d
 6 |  j | j  d  S(   Ni˙˙˙˙(   R   R
   c           B   s   e  Z d    Z d   Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   bar9   s    c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   baz;   s    (   R   R   R!   R"   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
   8   s   	t   ISpamc           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   qux>   s    (   R   R   R$   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR#   =   s   t   testingR!   R"   R$   (    (   R   R   R   R   R   R   R   R   (   R   R   R
   R#   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_w_allowed_interfaces6   s    !c         C   sP   |  j  t   d d d  } |  j | j i d d 6d d 6 |  j | j  d  S(   NR%   R   R!   (    (   s   foos   bar(   R   R   R   R   R   R   (   R   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_w_allowed_attributesE   s    (   R   R   R   R    R&   R'   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR   *   s   			t   Test_proxifyc           B   sG   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         O   s   d d l  m } | | |   S(   Ni˙˙˙˙(   t   proxify(   R   R)   (   R   R   R   R)   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR   N   s    c         C   s   d t  f d     Y} |   S(   Nt   _Contextc           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   T   s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR*   S   s   (   R   (   R   R*   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   _makeContextR   s    c         C   s,   |  j    } |  j t |  j | d d d  S(   Nt
   permissionR%   (   R+   t   assertRaisest
   ValueErrorR   (   R   t   ctx(    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_no_checker_no_providesX   s    c         C   sR   d d l  m } d | f d     Y} |  j   } |  j t |  j | d | d  S(   Ni˙˙˙˙(   R   R
   c           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   _   s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
   ^   s   t   provides(   R   R   R+   R-   R.   R   (   R   R   R
   R/   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_no_checker_no_permission\   s    c         C   s˝   d d l  m } d d l m } d d l m } d | f d     Y} |  j   } |  j | d | d d	 } |  j | |  | k  | j	 } |  j
 | j i | d
 6 |  j | j  d  S(   Ni˙˙˙˙(   R   (   R   (   t   getProxiedObjectR
   c           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   i   s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
   h   s   R1   R,   s   zope.PublicR!   (   R   R   R   R   t
   zope.proxyR3   R+   R   t
   assertTruet   __Security_checker__R   R   R   R   (   R   R   R   R3   R
   R/   R   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt0   test_no_checker_w_provides_and_permission_publicd   s    	c         C   s­   d d l  m } d d l m } d | f d     Y} |  j   } |  j | d | d d } |  j | |  | k  | j } |  j | j	 i d d	 6 |  j
 | j  d  S(
   Ni˙˙˙˙(   R   (   R3   R
   c           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   v   s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
   u   s   R1   R,   R%   R!   (   R   R   R4   R3   R+   R   R5   R6   R   R   R   R   (   R   R   R3   R
   R/   R   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt3   test_no_checker_w_provides_and_permission_protectedr   s    	c         C   sj   d d l  m } t   } |  j   } |  j | |  } |  j | |  | k  |  j | j | k  d  S(   Ni˙˙˙˙(   R3   (   R4   R3   R   R+   R   R5   R6   (   R   R3   t   _CHECKERR/   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_w_checker   s    	(	   R   R   R   R+   R0   R2   R7   R8   R:   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR(   L   s   						t   Test_protectedFactoryc           B   s#   e  Z d    Z d   Z d   Z RS(   c         O   s   d d l  m } | | |   S(   Ni˙˙˙˙(   t   protectedFactory(   R   R<   (   R   R   R   R<   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR      s    c         C   sĄ   d d l  m } d d l m } d | f d     Y} d t f d     Y} |  j | | d  } |  j | j | k  |   } |  j | j	 j
 i | d	 6 d  S(
   Ni˙˙˙˙(   R   (   R   R
   c           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!      s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
      s   t   _Factoryc           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!      s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=      s   s   zope.PublicR!   (   R   R   R   R   R   R   R5   t   factoryR   R6   R   (   R   R   R   R
   R=   t	   protectedR   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_public_not_already_proxied   s    	c         C   s   d d l  m } d d l m } d | f d     Y} d t f d     Y} |  j | | d  } |  j | j | k  |   } |  j | |  d
 g  d  S(   Ni˙˙˙˙(   R   (   t   getTestProxyItemsR
   c           B   s   e  Z d    Z RS(   c         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   Ą   s    (   R   R   R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR
       s   R=   c           B   s   e  Z d Z d   Z RS(   t   onec         S   s   d  S(   N(    (   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR!   Ľ   s    (   RB   (   R   R   t	   __slots__R!   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Ł   s   R%   R!   (   s   bars   testing(	   R   R   t   zope.security.proxyRA   R   R   R5   R>   R   (   R   R   RA   R
   R=   R?   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_nonpublic_already_proxied   s    	(   R   R   R   R@   RE   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR;      s   		t   Test_securityAdapterFactoryc           B   sb   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   c         O   s   d d l  m } | | |   S(   Ni˙˙˙˙(   t   securityAdapterFactory(   R   RG   (   R   R   R   RG   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR   Ż   s    c         C   s?   d t  f d     Y} |  j |  j | d  t t  | k  d  S(   NR=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   ´   s   (   R   R5   R   t   Nonet   False(   R   R=   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt(   test_no_permission_untrusted_no_locationł   s    c         C   s?   d t  f d     Y} |  j |  j | d t t  | k  d  S(   NR=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   ş   s   s   zope.Public(   R   R5   R   RI   (   R   R=   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt!   test_public_untrusted_no_locationš   s    c         C   sO   d d l  m } d t f d     Y} |  j |  j | | t t  | k  d  S(   Ni˙˙˙˙(   R   R=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Á   s   (   R   R   R   R5   R   RI   (   R   R   R=   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt(   test_CheckerPublic_untrusted_no_locationż   s    c         C   sX   d d l  m } d t f d     Y} |  j | d t t  } |  j t | |   d  S(   Ni˙˙˙˙(   t   LocatingUntrustedAdapterFactoryR=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Č   s   R%   (   t   zope.security.adapterRM   R   R   RI   R5   t
   isinstance(   R   RM   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt$   test_protected_untrusted_no_locationĆ   s    c         C   sX   d d l  m } d t f d     Y} |  j | d  t t  } |  j t | |   d  S(   Ni˙˙˙˙(   t   LocatingTrustedAdapterFactoryR=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Ď   s   (	   RN   RQ   R   R   RH   RI   t   TrueR5   RO   (   R   RQ   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt&   test_no_permission_trusted_no_locationÍ   s    c         C   sX   d d l  m } d t f d     Y} |  j | d t t  } |  j t | |   d  S(   Ni˙˙˙˙(   RQ   R=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Ö   s   s   zope.Public(   RN   RQ   R   R   RI   RR   R5   RO   (   R   RQ   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   test_public_trusted_no_locationÔ   s    c         C   sh   d d l  m } d d l m } d t f d     Y} |  j | | t t  } |  j t	 | |   d  S(   Ni˙˙˙˙(   RQ   (   R   R=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   Ţ   s   (
   RN   RQ   R   R   R   R   RI   RR   R5   RO   (   R   RQ   R   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt&   test_CheckerPublic_trusted_no_locationŰ   s
    c         C   sX   d d l  m } d t f d     Y} |  j | d t t  } |  j t | |   d  S(   Ni˙˙˙˙(   RQ   R=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   ĺ   s   R%   (   RN   RQ   R   R   RI   RR   R5   RO   (   R   RQ   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt"   test_protected_trusted_no_locationă   s    c         C   sX   d d l  m } d t f d     Y} |  j | d t t  } |  j t | |   d  S(   Ni˙˙˙˙(   RQ   R=   c           B   s   e  Z RS(    (   R   R   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyR=   ě   s   R%   (   RN   RQ   R   R   RR   R5   RO   (   R   RQ   R=   R   (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt!   test_protected_trusted_w_locationę   s    (   R   R   R   RJ   RK   RL   RP   RS   RT   RU   RV   RW   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyRF   ­   s   									c           C   sI   t  j t  j t  t  j t  t  j t  t  j t  t  j t  f  S(   N(   t   unittestt	   TestSuitet	   makeSuiteR    R   R(   R;   RF   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt
   test_suiteň   s    (	   t   __doc__RX   t   TestCaseR    R   R(   R;   RF   R[   (    (    (    sF   /usr/lib/python2.7/site-packages/zope/component/tests/test_security.pyt   <module>   s   "<%E