Current File : //usr/lib/python3/dist-packages/lazr/restfulclient/tests/__pycache__/test_error.cpython-312.pyc |
�
}�;e/
� � � d Z eZddlZddlmZmZmZmZm Z m
Z
mZmZm
Z
G d� de� Z G d� dej � Zy)z(Tests for the error_for helper function.� N) �ClientError�Conflict�MethodNotAllowed�NotFound�PreconditionFailed�
ResponseError�ServerError�Unauthorized� error_forc � � e Zd ZdZd� Zy)�StubRequestz-Just enough of a request to fool error_for().c � � || _ y )N)�status��selfr s �E/usr/lib/python3/dist-packages/lazr/restfulclient/tests/test_error.py�__init__zStubRequest.__init__( s � ���� N)�__name__�
__module__�__qualname__�__doc__r � r r r
r
% s
� �7�r r
c �P � e Zd Zd
d�Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
y)�TestErrorForc �� � t |� }t ||� }|�| j |� y| j t ||� � | j ||j � y)z9Make sure error_for returns the right HTTPError subclass.N)r
r �assertIsNone�
assertTrue�
isinstance�assertEqual�content)r r �expected_errorr! �request�errors r �error_for_statuszTestErrorFor.error_for_status- sS � ��f�%���'�7�+���!����e�$��O�O�J�u�n�=�>����W�e�m�m�4r c �6 � dD ] }| j |d� � y)z.Make sure a 2xx response code yields no error.)�� �� �� i+ N�r% r s r �test_no_error_for_2xxz"TestErrorFor.test_no_error_for_2xx7 s! � �*� 0�F��!�!�&�$�/� 0r c �6 � dD ] }| j |d� � y)z.Make sure a 3xx response code yields no error.)i- i. i/ i0 i� Nr* r s r �test_no_error_for_3xxz"TestErrorFor.test_no_error_for_3xx<