HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/samba/tests/blackbox/__pycache__/netads_json.cpython-310.pyc
o

�/aM�@sjddlZddlZddlZddlmZdZe�d�ZGdd�de	�Z
Gdd�de
j�ZGd	d
�d
e
j�Z
dS)�N)�
get_stringzbin/net adsz^([^ 	:][^:]*):c@s$eZdZdZGdd�dejj�ZdS)�BaseWrapperzw
    Guard the base so it doesn't inherit from TestCase. This prevents it from
    being run by unittest directly.
    cs4eZdZdZdZ�fdd�Zdd�Zdd�Z�ZS)	z BaseWrapper.NetAdsJSONTests_Basez@Blackbox tests for JSON output of the net ads suite of commands.Ncsttj|���dS)N)�superr�NetAdsJSONTests_Base�setUp)�self��	__class__��B/usr/lib/python3/dist-packages/samba/tests/blackbox/netads_json.pyr&sz&BaseWrapper.NetAdsJSONTests_Base.setUpc
Csjdt|jf}z|�|�}t�t|��WdStjjy4}z|�	d||f�WYd}~dSd}~ww)z5The output of ``--json`` commands must parse as JSON.�%s %s --json�Error calling [%s]: %sN)
�COMMAND�subcmd�check_output�json�loadsr�samba�tests�BlackboxProcessError�fail)r�argv�out�er
r
r�test_json_wellformed)s
 ��z5BaseWrapper.NetAdsJSONTests_Base.test_json_wellformedc
Csdt|jf}z	t|�|��}Wntjjy-}z|�d||f�WYd}~nd}~wwdt|jf}z|�|�}WntjjyY}z|�d||f�WYd}~nd}~wwt�	t|��}dd�|�
d�D�D]}|�|�|�du�||=qk|�t
|�dk�dS)	z�
            The ``--json`` variants must contain the same keys as their
            respective plain counterpart.

            Does not check nested dictionaries (e. g. the ``Flags`` value of
            ``net ads lookup``..
            z%s %sr
NrcSs2g|]}|dkr|ddvrt�t|��d��qS)�rz 	:�)�re�match�PLAIN_KEY_REGEX�group)�.0�liner
r
r�
<listcomp>Hs
�zOBaseWrapper.NetAdsJSONTests_Base.test_json_matching_entries.<locals>.<listcomp>�
r)rrrrrrrrrr�split�
assertTrue�get�len)rr�	out_plainr�	out_jsobj�parsed�keyr
r
r�test_json_matching_entries2s*����
�z;BaseWrapper.NetAdsJSONTests_Base.test_json_matching_entries)	�__name__�
__module__�__qualname__�__doc__rrrr-�
__classcell__r
r
rrr"s	rN)r.r/r0r1rr�BlackboxTestCaserr
r
r
rrsrc@�eZdZdZdS)�NetAdsJSONInfoTests�infoN�r.r/r0rr
r
r
rr5P�r5c@r4)�NetAdsJSONlookupTests�lookupNr7r
r
r
rr9Sr8r9)rr�samba.testsr�samba.commonrr�compiler�objectrrr5r9r
r
r
r�<module>s
4