File: //usr/lib/python3/dist-packages/django/test/__pycache__/client.cpython-310.pyc
o
3�a�� � @ s* d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZ d dl
mZmZmZmZ d dlmZ d d lmZ d d
lmZ d dlmZ d dlmZ d d
lmZ d dlmZm Z m!Z! d dl"m#Z# d dl$m%Z%m&Z&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5 d dl6m7Z7 dZ8dZ9de9 Z:e7d�Z;e7d�Z<G dd� de=�Z>G d d!� d!�Z?d"d#� Z@d$d%� ZAG d&d'� d'e�ZBG d(d)� d)e�ZCd*d+� ZDd,d-� ZEd.d/� ZFG d0d1� d1�ZGG d2d3� d3eG�ZHG d4d5� d5�ZIG d6d7� d7eIeG�ZJG d8d9� d9eIeH�ZKdS ):� N)�copy)�partial)�
HTTPStatus)�
import_module)�BytesIO)�unquote_to_bytes�urljoin�urlparse�urlsplit)�
sync_to_async)�settings)�ASGIRequest)�BaseHandler)�WSGIRequest)�DjangoJSONEncoder)�got_request_exception�request_finished�request_started)�close_old_connections)�HttpRequest� QueryDict�SimpleCookie)�signals)�ContextList��resolve)�force_bytes)�SimpleLazyObject)� urlencode)�is_iterable)�_lazy_re_compile)�AsyncClient�AsyncRequestFactory�Client�RedirectCycleError�RequestFactory�encode_file�encode_multipart�BoUnDaRyStRiNgz multipart/form-data; boundary=%sz.*; charset=([\w\d-]+);?z^application\/(.+\+)?jsonc s e Zd ZdZ� fdd�Z� ZS )r$ z9The test client has been asked to follow a redirect loop.c s t � �|� || _|j| _d S �N)�super�__init__�
last_response�redirect_chain)�self�messager, �� __class__� �4/usr/lib/python3/dist-packages/django/test/client.pyr+ 0 s zRedirectCycleError.__init__)�__name__�
__module__�__qualname__�__doc__r+ �
__classcell__r2 r2 r0 r3 r$ . s r$ c @ s4 e Zd ZdZddd�Zdd� Zddd�Zd d
� ZdS )�FakePayloada
A wrapper around BytesIO that restricts what can be read since data from
the network can't be sought and cannot be read outside of its content
length. This makes sure that views can't do anything under the test client
that wouldn't work in real life.
Nc C s. t � | _d| _d| _|d ur| �|� d S d S )Nr F)r �_FakePayload__content�_FakePayload__len�read_started�write�r. �contentr2 r2 r3 r+ = s �zFakePayload.__init__c C s | j S r) )r; )r. r2 r2 r3 �__len__D s zFakePayload.__len__c C sZ | j s| j�d� d| _ |d u r| jpd}| j|ksJ d��| j�|�}| j|8 _|S )Nr TzFCannot read more than the available bytes from the HTTP incoming data.)r<