File: //lib/python3/dist-packages/lazr/restfulclient/tests/__pycache__/test_error.cpython-310.pyc
o
��%U
� @ sb d Z eZddlZddlmZmZmZmZm Z m
Z
mZmZm
Z
G dd� de�ZG dd� dej�ZdS )z(Tests for the error_for helper function.� N) �ClientError�Conflict�MethodNotAllowed�NotFound�PreconditionFailed�
ResponseError�ServerError�Unauthorized� error_forc @ s e Zd ZdZdd� ZdS )�DummyRequestz-Just enough of a request to fool error_for().c C s
|| _ d S )N)�status��selfr � r �E/usr/lib/python3/dist-packages/lazr/restfulclient/tests/test_error.py�__init__ s
zDummyRequest.__init__N)�__name__�
__module__�__qualname__�__doc__r r r r r r s r c @ sf e Zd Zddd�Zdd� Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dS )�TestErrorFor� c C sJ t |�}t||�}|du r| �|� dS | �t||�� | �||j� dS )z9Make sure error_for returns the right HTTPError subclass.N)r r
�assertIsNone�
assertTrue�
isinstance�assertEqual�content)r r �expected_errorr �request�errorr r r �error_for_status% s
zTestErrorFor.error_for_statusc C � dD ]}| � |d� qdS )z.Make sure a 2xx response code yields no error.)�� �� �� i+ N�r r
r r r �test_no_error_for_2xx/ � �z"TestErrorFor.test_no_error_for_2xxc C r! )z.Make sure a 3xx response code yields no error.)i- i. i/ i0 i� Nr% r
r r r �test_no_error_for_3xx4 r'