a
    œcl_C  ã                   @   s^   d Z ddlZej dd¡ ddlZddlZddlmZ ddlZe 	¡  G dd„ dej
jƒZdS )zGTests for the talloc handling in the generated Python DCE/RPC bindings.é    Nz
bin/python)Údrsuapic                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚTallocTestsz3test talloc behaviour of pidl generated python codec                 C   s,   t  |¡}|du r|| j8 }|  ||¡ dS )z4check that the number of allocated blocks is correctN)ÚtallocÚtotal_blocksÚinitial_blocksZassertEqual)ÚselfÚobjectZnum_expectedZnblocks© r	   ú?/usr/lib/python3/dist-packages/samba/tests/dcerpc/rpc_talloc.pyÚcheck_blocks+   s    

zTallocTests.check_blocksc                 C   sB   t  ¡ }|  |d¡ g d¢}d|_||_t|ƒ|_|  |d¡ |S )z-get a list of attributes for RODC replicationé   )r   é   é   r   )r   ZDsPartialAttributeSetr   ÚversionÚattidsÚlenZ
num_attids)r   Úpartial_attribute_setr   r	   r	   r
   Úget_rodc_partial_attribute_set2   s    
z*TallocTests.get_rodc_partial_attribute_setc                 C   sb   |   ¡ }|  |d¡ t ¡ }|  |d¡ |  d d¡ ||_|jjd dkrRtdƒ‚|  d d¡ d S )Nr   r   é   zWrong value in attids[2]é   )r   r   r   ZDsGetNCChangesRequest8r   r   Ú	Exception)r   ZpasZreq8r	   r	   r
   Úpas_testD   s    zTallocTests.pas_testc                 C   s0   t  d ¡| _|  d d¡ |  ¡  |  d d¡ d S )Nr   )r   r   r   r   r   )r   r	   r	   r
   Útest_runR   s    zTallocTests.test_runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r	   r	   r	   r
   r   (   s
   r   )r   ÚsysÚpathÚinsertZsambaZsamba.testsZsamba.dcerpcr   r   Zenable_null_trackingZtestsZTestCaser   r	   r	   r	   r
   Ú<module>   s   