HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/zope/component/tests/__pycache__/test_security.cpython-36.pyc
3

,�W�$�@srdZddlZGdd�dej�ZGdd�dej�ZGdd�dej�ZGd	d
�d
ej�ZGdd�dej�Zd
d�ZdS)zPure-Python hookable tests
�Nc@s$eZdZdd�Zdd�Zdd�ZdS)�PermissionProxyTestscCsddlm}|S)Nr)�PermissionProxy)�zope.component.securityr)�selfr�r�#/usr/lib/python3.6/test_security.py�_getTargetClasssz$PermissionProxyTests._getTargetClasscCs|j�|�S)N)r)r�wrappedrrr�_makeOneszPermissionProxyTests._makeOnecCstddlm}ddlm}ddlm}Gdd�d|�}||�Gdd�dt��}|�}|j|�}|j||�||��dS)	Nr)�	Interface)�implementer)�
providedByc@seZdZdS)zGPermissionProxyTests.test_proxy_delegates___provided_by__.<locals>.IFooN)�__name__�
__module__�__qualname__rrrr�IFoo src@seZdZdS)zFPermissionProxyTests.test_proxy_delegates___provided_by__.<locals>.FooN)rrrrrrr�Foo"sr)�zope.interfacerrr
�objectr
�assertEqual)rrrr
rr�foo�proxyrrr�$test_proxy_delegates___provided_by__s
z9PermissionProxyTests.test_proxy_delegates___provided_by__N)rrrrr
rrrrrrsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
Test__checkercOsddlm}|||�S)Nr)�_checker)rr)r�args�kwrrrr�_callFUT,szTest__checker._callFUTcCs@ddlm}|jt�dff�}|j|jd|i�|j|j�dS)Nr)�
CheckerPubliczzope.Public�__call__)�zope.security.checkerrrrr�get_permissions�assertFalse�set_permissions)rr�checkerrrr�0test_no_allowed_attributes_no_allowed_interfaces0sz>Test__checker.test_no_allowed_attributes_no_allowed_interfacescCshddlm}Gdd�d|�}Gdd�d|�}|jt�d||ff�}|j|jdddd��|j|j�dS)	Nr)rc@seZdZdd�Zdd�ZdS)z5Test__checker.test_w_allowed_interfaces.<locals>.IFoocSsdS)Nr)rrrr�bar9sz9Test__checker.test_w_allowed_interfaces.<locals>.IFoo.barcSsdS)Nr)rrrr�baz;sz9Test__checker.test_w_allowed_interfaces.<locals>.IFoo.bazN)rrrr&r'rrrrr8src@seZdZdd�ZdS)z6Test__checker.test_w_allowed_interfaces.<locals>.ISpamcSsdS)Nr)rrrr�qux>sz:Test__checker.test_w_allowed_interfaces.<locals>.ISpam.quxN)rrrr(rrrr�ISpam=sr)�testing)r&r'r()rrrrrr!r"r#)rrrr)r$rrr�test_w_allowed_interfaces6sz'Test__checker.test_w_allowed_interfacescCs6|jt�dfd�}|j|jddd��|j|j�dS)Nr*rr&)rr&)rr&)rrrr!r"r#)rr$rrr�test_w_allowed_attributesEsz'Test__checker.test_w_allowed_attributesN)rrrrr%r+r,rrrrr*src@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�Test_proxifycOsddlm}|||�S)Nr)�proxify)rr.)rrrr.rrrrNszTest_proxify._callFUTcCsGdd�dt�}|�S)Nc@seZdZdd�ZdS)z+Test_proxify._makeContext.<locals>._ContextcSsdS)Nr)rrrrr&Tsz/Test_proxify._makeContext.<locals>._Context.barN)rrrr&rrrr�_ContextSsr/)r)rr/rrr�_makeContextRszTest_proxify._makeContextcCs |j�}|jt|j|dd�dS)Nr*)�
permission)r0�assertRaises�
ValueErrorr)r�ctxrrr�test_no_checker_no_providesXsz(Test_proxify.test_no_checker_no_providescCs<ddlm}Gdd�d|�}|j�}|jt|j||d�dS)Nr)rc@seZdZdd�ZdS)z8Test_proxify.test_no_checker_no_permission.<locals>.IFoocSsdS)Nr)rrrrr&_sz<Test_proxify.test_no_checker_no_permission.<locals>.IFoo.barN)rrrr&rrrrr^sr)�provides)rrr0r2r3r)rrrr4rrr�test_no_checker_no_permission\sz*Test_proxify.test_no_checker_no_permissioncCs�ddlm}ddlm}ddlm}Gdd�d|�}|j�}|j||dd�}|j||�|k�|j	}|j
|jd	|i�|j|j
�dS)
Nr)r)r)�getProxiedObjectc@seZdZdd�ZdS)zKTest_proxify.test_no_checker_w_provides_and_permission_public.<locals>.IFoocSsdS)Nr)rrrrr&iszOTest_proxify.test_no_checker_w_provides_and_permission_public.<locals>.IFoo.barN)rrrr&rrrrrhsrzzope.Public)r6r1r&)rrr r�
zope.proxyr8r0r�
assertTrue�__Security_checker__rr!r"r#)rrrr8rr4rr$rrr�0test_no_checker_w_provides_and_permission_publicdsz=Test_proxify.test_no_checker_w_provides_and_permission_publiccCszddlm}ddlm}Gdd�d|�}|j�}|j||dd�}|j||�|k�|j}|j|j	ddi�|j
|j�dS)	Nr)r)r8c@seZdZdd�ZdS)zNTest_proxify.test_no_checker_w_provides_and_permission_protected.<locals>.IFoocSsdS)Nr)rrrrr&vszRTest_proxify.test_no_checker_w_provides_and_permission_protected.<locals>.IFoo.barN)rrrr&rrrrrusrr*)r6r1r&)rrr9r8r0rr:r;rr!r"r#)rrr8rr4rr$rrr�3test_no_checker_w_provides_and_permission_protectedrsz@Test_proxify.test_no_checker_w_provides_and_permission_protectedcCsLddlm}t�}|j�}|j||�}|j||�|k�|j|j|k�dS)Nr)r8)r9r8rr0rr:r;)rr8Z_CHECKERr4rrrr�test_w_checkerszTest_proxify.test_w_checkerN)
rrrrr0r5r7r<r=r>rrrrr-Ls
r-c@s$eZdZdd�Zdd�Zdd�ZdS)�Test_protectedFactorycOsddlm}|||�S)Nr)�protectedFactory)rr@)rrrr@rrrr�szTest_protectedFactory._callFUTcCstddlm}ddlm}Gdd�d|�}Gdd�dt�}|j||d�}|j|j|k�|�}|j|j	j
d	|i�dS)
Nr)r)rc@seZdZdd�ZdS)zCTest_protectedFactory.test_public_not_already_proxied.<locals>.IFoocSsdS)Nr)rrrrr&�szGTest_protectedFactory.test_public_not_already_proxied.<locals>.IFoo.barN)rrrr&rrrrr�src@seZdZdd�ZdS)zGTest_protectedFactory.test_public_not_already_proxied.<locals>._FactorycSsdS)Nr)rrrrr&�szKTest_protectedFactory.test_public_not_already_proxied.<locals>._Factory.barN)rrrr&rrrr�_Factory�srAzzope.Publicr&)rrr rrrr:�factoryrr;r!)rrrrrA�	protectedrrrr�test_public_not_already_proxied�s
z5Test_protectedFactory.test_public_not_already_proxiedcCsrddlm}ddlm}Gdd�d|�}Gdd�dt�}|j||d�}|j|j|k�|�}|j||�d
g�dS)Nr)r)�getTestProxyItemsc@seZdZdd�ZdS)zBTest_protectedFactory.test_nonpublic_already_proxied.<locals>.IFoocSsdS)Nr)rrrrr&�szFTest_protectedFactory.test_nonpublic_already_proxied.<locals>.IFoo.barN)rrrr&rrrrr�src@seZdZdZdd�ZdS)zFTest_protectedFactory.test_nonpublic_already_proxied.<locals>._Factory�onecSsdS)Nr)rrrrr&�szJTest_protectedFactory.test_nonpublic_already_proxied.<locals>._Factory.barN)rF)rrr�	__slots__r&rrrrrA�srAr*r&)r&r*)	rrZzope.security.proxyrErrr:rBr)rrrErrArCrrrr�test_nonpublic_already_proxied�sz4Test_protectedFactory.test_nonpublic_already_proxiedN)rrrrrDrHrrrrr?�sr?c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�Test_securityAdapterFactorycOsddlm}|||�S)Nr)�securityAdapterFactory)rrJ)rrrrJrrrr�sz$Test_securityAdapterFactory._callFUTcCs.Gdd�dt�}|j|j|ddd�|k�dS)Nc@seZdZdS)zVTest_securityAdapterFactory.test_no_permission_untrusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAF)rr:r)rrArrr�(test_no_permission_untrusted_no_location�szDTest_securityAdapterFactory.test_no_permission_untrusted_no_locationcCs.Gdd�dt�}|j|j|ddd�|k�dS)Nc@seZdZdS)zOTest_securityAdapterFactory.test_public_untrusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAzzope.PublicF)rr:r)rrArrr�!test_public_untrusted_no_location�sz=Test_securityAdapterFactory.test_public_untrusted_no_locationcCs:ddlm}Gdd�dt�}|j|j||dd�|k�dS)Nr)rc@seZdZdS)zVTest_securityAdapterFactory.test_CheckerPublic_untrusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAF)r rrr:r)rrrArrr�(test_CheckerPublic_untrusted_no_location�szDTest_securityAdapterFactory.test_CheckerPublic_untrusted_no_locationcCs@ddlm}Gdd�dt�}|j|ddd�}|jt||��dS)Nr)�LocatingUntrustedAdapterFactoryc@seZdZdS)zRTest_securityAdapterFactory.test_protected_untrusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAr*F)�zope.security.adapterrNrrr:�
isinstance)rrNrArrrr�$test_protected_untrusted_no_location�sz@Test_securityAdapterFactory.test_protected_untrusted_no_locationcCs@ddlm}Gdd�dt�}|j|ddd�}|jt||��dS)Nr)�LocatingTrustedAdapterFactoryc@seZdZdS)zTTest_securityAdapterFactory.test_no_permission_trusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAFT)rOrRrrr:rP)rrRrArrrr�&test_no_permission_trusted_no_location�szBTest_securityAdapterFactory.test_no_permission_trusted_no_locationcCs@ddlm}Gdd�dt�}|j|ddd�}|jt||��dS)Nr)rRc@seZdZdS)zMTest_securityAdapterFactory.test_public_trusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAzzope.PublicFT)rOrRrrr:rP)rrRrArrrr�test_public_trusted_no_location�sz;Test_securityAdapterFactory.test_public_trusted_no_locationcCsLddlm}ddlm}Gdd�dt�}|j||dd�}|jt||��dS)Nr)rR)rc@seZdZdS)zTTest_securityAdapterFactory.test_CheckerPublic_trusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAFT)rOrRr rrrr:rP)rrRrrArrrr�&test_CheckerPublic_trusted_no_location�s
zBTest_securityAdapterFactory.test_CheckerPublic_trusted_no_locationcCs@ddlm}Gdd�dt�}|j|ddd�}|jt||��dS)Nr)rRc@seZdZdS)zPTest_securityAdapterFactory.test_protected_trusted_no_location.<locals>._FactoryN)rrrrrrrrA�srAr*FT)rOrRrrr:rP)rrRrArrrr�"test_protected_trusted_no_location�sz>Test_securityAdapterFactory.test_protected_trusted_no_locationcCs@ddlm}Gdd�dt�}|j|ddd�}|jt||��dS)Nr)rRc@seZdZdS)zOTest_securityAdapterFactory.test_protected_trusted_w_location.<locals>._FactoryN)rrrrrrrrA�srAr*T)rOrRrrr:rP)rrRrArrrr�!test_protected_trusted_w_location�sz=Test_securityAdapterFactory.test_protected_trusted_w_locationN)
rrrrrKrLrMrQrSrTrUrVrWrrrrrI�srIcCs2tjtjt�tjt�tjt�tjt�tjt�f�S)N)�unittestZ	TestSuiteZ	makeSuiterrr-r?rIrrrr�
test_suite�srY)	�__doc__rXZTestCaserrr-r?rIrYrrrr�<module>s"<%E