404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.145.9.174: ~ $
3

��:X�@slddlmZmZmZddlmZddlmZddlm	Z	m
Z
dd�ZGdd�de
j�Z
Gd	d
�d
e
j�ZdS)�)�Draft4Validator�ValidationError�cli)�StringIO)�SchemaError)�mock�unittestcs$tt����G�fdd�dt�}|S)Ncs(eZdZdd�Z�fdd�Zdd�ZdS)z%fake_validator.<locals>.FakeValidatorc_sdS)N�)�self�args�kwargsr	r	�/usr/lib/python3.6/test_cli.py�__init__sz.fake_validator.<locals>.FakeValidator.__init__cs�r�j�SgS)N)�pop)r
�instance)�errorsr	r
�iter_errorssz1fake_validator.<locals>.FakeValidator.iter_errorscSsdS)Nr	)r
�schemar	r	r
�check_schemasz2fake_validator.<locals>.FakeValidator.check_schemaN)�__name__�
__module__�__qualname__rrrr	)rr	r
�
FakeValidator
sr)�list�reversed�object)rrr	)rr
�fake_validatorsrc@s*eZdZe�Zdd�Zdd�Zdd�ZdS)�
TestParsercCs`tj�}tjjtd|dd�}|j�|j|j�tj�}i|_	tjd�}|j�|j|j�dS)N�openT)Zcreatez	json.load)
r�	mock_openZpatchrr�startZ
addCleanup�stopZMockZreturn_value)r
rZ
patch_openZmock_json_loadZpatch_json_loadr	r	r
�setUps
zTestParser.setUpcCs*tjdddddg�}|j|d|j�dS)Nz--validatorz2jsonschema.tests.test_cli.TestParser.FakeValidatorz
--instancezfoo.jsonzschema.json�	validator)r�
parse_args�assertIsr)r
�	argumentsr	r	r
�2test_find_validator_by_fully_qualified_object_name(sz=TestParser.test_find_validator_by_fully_qualified_object_namecCs(tjdddddg�}|j|dt�dS)Nz--validatorrz
--instancezfoo.jsonzschema.jsonr#)rr$r%r)r
r&r	r	r
�!test_find_validator_in_jsonschema3s
z,TestParser.test_find_validator_in_jsonschemaN)rrrrrr"r'r(r	r	r	r
rsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestCLIcCsZt�t�}}|jt��8tjtdddiddiddigidgd	d
�||d�WdQRXdS)NZanyOfZminimum��type�stringZrequiredT�z{error.message})r#r�	instances�error_format)�stdout�stderr)rZassertRaisesrr�runr)r
r0r1r	r	r
�#test_draft3_schema_draft4_validator?s
z+TestCLI.test_draft3_schema_draft4_validatorcCsXt�t�}}tjt�idgdd�||d�}|j|j��|j|j��|j|d�dS)Nr-z{error.message})r#rr.r/)r0r1r)rrr2r�assertFalse�getvalue�assertEqual)r
r0r1�	exit_coder	r	r
�test_successful_validationSsz"TestCLI.test_successful_validationcCsjtddd�}t�t�}}tjt|g�idgdd�||d�}|j|j��|j|j�d�|j|d�dS)NzI am an error!r-)rz"{error.instance} - {error.message})r#rr.r/)r0r1z1 - I am an error!)rrrr2rr4r5r6)r
�errorr0r1r7r	r	r
�test_unsuccessful_validationcsz$TestCLI.test_unsuccessful_validationcCs�tddd�tddd�g}tddd�g}t�t�}}tjt||�iddgdd�||d	�}|j|j��|j|j�d
�|j|d�dS)N�9r-)r�8�7�z#{error.instance} - {error.message}	)r#rr.r/)r0r1z1 - 9	1 - 8	2 - 7	)rrrr2rr4r5r6)r
Zfirst_errorsZ
second_errorsr0r1r7r	r	r
�/test_unsuccessful_validation_multiple_instancests
z7TestCLI.test_unsuccessful_validation_multiple_instancesN)rrrr3r8r:r?r	r	r	r
r)>sr)N)Z
jsonschemarrrZjsonschema.compatrZjsonschema.exceptionsrZjsonschema.tests.compatrrrZTestCaserr)r	r	r	r
�<module>s%

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
compat.cpython-36.opt-1.pyc File 305 B 0644
compat.cpython-36.pyc File 305 B 0644
test_cli.cpython-36.opt-1.pyc File 4.31 KB 0644
test_cli.cpython-36.pyc File 4.31 KB 0644
test_exceptions.cpython-36.opt-1.pyc File 13.37 KB 0644
test_exceptions.cpython-36.pyc File 13.37 KB 0644
test_format.cpython-36.opt-1.pyc File 2.74 KB 0644
test_format.cpython-36.pyc File 2.74 KB 0644
test_jsonschema_test_suite.cpython-36.opt-1.pyc File 9.67 KB 0644
test_jsonschema_test_suite.cpython-36.pyc File 9.71 KB 0644
test_validators.cpython-36.opt-1.pyc File 31.29 KB 0644
test_validators.cpython-36.pyc File 31.29 KB 0644